!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("cesium"),require("@turf/turf")):"function"==typeof define&&define.amd?define(["exports","cesium","@turf/turf"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).PIE3D={},t.Cesium,t.turf)}(this,(function(t,e,i){"use strict";var s,r=Object.defineProperty,a=t=>{throw TypeError(t)},n=(t,e,i)=>((t,e,i)=>e in t?r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i)(t,"symbol"!=typeof e?e+"":e,i),o=(t,e,i)=>e.has(t)||a("Cannot "+i),l=(t,e,i)=>(o(t,e,"read from private field"),i?i.call(t):e.get(t)),h=(t,e,i,s)=>(o(t,e,"write to private field"),s?s.call(t,i):e.set(t,i),i);function c(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t)for(const i in t)if("default"!==i){const s=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:()=>t[i]})}return e.default=t,Object.freeze(e)}const u=c(e),d=c(i),p="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI2MjNjYmVlOC1kZDA0LTQ0OGUtYTVjZS1jNDFlNTYxZTdkMjkiLCJpZCI6MjAxOTQ4LCJpYXQiOjE3MTA0MjI1ODZ9.giSWCQOKlRs3mxr3X1Z1grwevurK1c89rNhLueeEvQo",m=[108,34],f=(t,e)=>t?e.reduce(((e,i)=>(Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]),e)),{}):{},_=Object.prototype.toString;function y(t,e){return _.call(t)==="[object "+e+"]"}function g(t){return void 0!==t}function v(t){return null!==t&&y(t,"Object")}function M(t){return y(t,"Number")}function C(t){return y(t,"String")}function x(t){return"function"==typeof t}function b(t){return y(t,"Boolean")}function w(t){return t&&Array.isArray(t)}function P(t){return null!==t&&"object"==typeof t&&1===t.nodeType&&"string"==typeof t.tagName}function S(t){return t&&"object"==typeof t&&"[object RegExp]"!==Object.prototype.toString.call(t)&&"[object Date]"!==Object.prototype.toString.call(t)}function T(t){return null!=t&&null!=t&&!!(C(t)||b(t)||M(t)||Array.isArray(t))}function E(t,e=0){const i=10**e;return Math.round(t*i)/i}const k=/\{\{\s*([\w\u4E00-\u9FA5]+)\s*\}\}/g;function I(t,e,i=!1){return null!=t&&k.test(t)?t.replace(k,((t,s,r,a)=>{let n=((t,e,i)=>{const s=e.split(/[\.\[\]]/g);let r=t;for(const a of s){if(null===r)return i;if(void 0===r)return i;const t=a.replace(/['"]/g,"");""!==t.trim()&&(r=r[t])}return void 0===r?i:r})(e,s);if(!u.defined(n))return i?"":t;if(x(n)){if(n=n(e),!u.defined(n))return i?"":t}else if(n.getValue&&x(n.getValue)&&(n=n.getValue(u.JulianDate.now()),!u.defined(n)))return i?"":t;return n})):t}const L=class t{constructor(t,e,i){n(this,"_lng"),n(this,"_lat"),n(this,"_alt"),this._lng=void 0!==t?+t:0,this._lat=void 0!==e?+e:0,this._alt=void 0!==i?+i:0}static parse(e,i){if(!e)return new t;let s;if("string"==typeof e)s=t.fromString(e);else if(Array.isArray(e))s=t.fromArray(e);else if(e instanceof t)s=e.clone();else if(u.defined(e.lat)&&u.defined(e.lng)){s=new t(e.lng,e.lat,e.alt);for(const t in e)s[t]=e[t]}else if(e instanceof u.Cartesian3||e._value||"function"==typeof e.getValue)s=t.fromCartesian(e,i);else if(e instanceof u.Cartographic)s=t.fromCartographic(e);else if(u.defined(e.x)&&u.defined(e.y)){const r=new u.Cartesian3(e.x,e.y,e.z);s=t.fromCartesian(r,i)}else s=new t,an("NOT_THROW","parse: 坐标解析失败，请确认参数是否无误："+e);return s}static fromArray(e){const i=new t;return Array.isArray(e)&&(i.lng=e[0]||0,i.lat=e[1]||0,i.alt=e[2]||0),i}static fromString(e){let i=new t;if(e&&"string"==typeof e){const s=e.split(",");i=t.fromArray(s.map(Number.parseFloat))}return i}static fromCartesian(e,i){const s=new t;let r;if(r=e instanceof u.Cartesian3?e:e._value&&e._value instanceof u.Cartesian3?e._value:"function"==typeof e.getValue?e.getValue(i||u.JulianDate.now()):void 0,r){const t=u.Cartographic.fromCartesian(r);t&&(s.lat=u.Math.toDegrees(t.latitude),s.lng=u.Math.toDegrees(t.longitude),s.alt=t.height,s.format())}return s}static fromCartographic(e){const i=new t;return e&&(i.lat=u.Math.toDegrees(e.latitude),i.lng=u.Math.toDegrees(e.longitude),i.alt=e.height),i}static toCartesian(e,i){return t.parse(e,i).toCartesian()}static toCartographic(e,i){return t.parse(e,i).toCartographic()}get lng(){return this._lng}set lng(t){this.setLng(+t)}setLng(t){this._lng=+t}get lat(){return this._lat}set lat(t){this.setLat(+t)}setLat(t){this._lat=+t}get alt(){return this._alt||0}set alt(t){this.setAlt(+t)}setAlt(t){this._alt=+t}clone(){const e=new t;return e.lng=this.lng||0,e.lat=this.lat||0,e.alt=this.alt||0,e}format(){return this.lng=E(this.lng,t.FormatLength),this.lat=E(this.lat,t.FormatLength),this.alt=E(this.alt,t.FormatAltLength),this}toArray(t=!1){return this.format(),t?[this.lng,this.lat,this.alt]:[this.lng,this.lat]}toString(){return this.format(),this.lng+","+this.lat+","+this.alt}toCartesian(){return u.Cartesian3.fromDegrees(this.lng,this.lat,this.alt)}toCartographic(){return u.Cartographic.fromDegrees(this.lng,this.lat,this.alt)}equals(e){return this===e||e instanceof t&&this._alt===e._alt&&this._lat===e._lat&&this._lng===e._lng}valid(){return 0!==this._lat&&this._lat>=-90&&this._lat<=90&&0!==this._lng&&this._lng>=-180&&this._lng<=180}};n(L,"FormatLength",6),n(L,"FormatAltLength",2);let A=L;const O={WGS84:"WGS84",GCJ02:"GCJ02",BD09:"BD09"},z={EPSG3857:"EPSG:3857",EPSG4326:"EPSG:4326",EPSG4490:"EPSG:4490",CGCS2000_GK_Zone_3:"CGCS2000_GK_Zone_3",CGCS2000_GK_Zone_6:"CGCS2000_GK_Zone_6",CGCS2000_GK_CM_3:"CGCS2000_GK_CM_3",CGCS2000_GK_CM_6:"CGCS2000_GK_CM_6"},R={DistanceColorChange:"DistanceColorChange",DynamicHalo:"DynamicHalo"},D={add:"add",remove:"remove",addGraphic:"addGraphic",removeGraphic:"removeGraphic",addLayer:"addLayer",removeLayer:"removeLayer",addControl:"addControl",removeControl:"removeControl",addEffect:"addEffect",removeEffect:"removeEffect",update:"update",updateStyle:"updateStyle",updateAttr:"updateAttr",show:"show",hide:"hide",start:"start",change:"change",endOne:"endOne",end:"end",stop:"stop",loadBeforeDeal:"loadBeforeDeal",load:"load",error:"error",loadConfig:"loadConfig",contextMenuOpen:"contextMenuOpen",contextMenuClose:"contextMenuClose",contextMenuClick:"contextMenuClick",highlightOpen:"highlightOpen",highlightClose:"highlightClose",click:"click",clickGraphic:"clickGraphic",clickTileGraphic:"clickTileGraphic",clickMap:"clickMap",dblClick:"dblClick",leftDown:"leftDown",leftUp:"leftUp",mouseMove:"mouseMove",mouseMoveTarget:"mouseMoveTarget",wheel:"wheel",rightClick:"rightClick",rightDown:"rightDown",rightUp:"rightUp",middleClick:"middleClick",middleDown:"middleDown",middleUp:"middleUp",pinchStart:"pinchStart",pinchEnd:"pinchEnd",pinchMove:"pinchMove",mouseDown:"mouseDown",mouseUp:"mouseUp",mouseOver:"mouseOver",mouseOut:"mouseOut",keydown:"keydown",keyup:"keyup",drawStart:"drawStart",drawMouseMove:"drawMouseMove",drawAddPoint:"drawAddPoint",drawRemovePoint:"drawRemovePoint",drawCreated:"drawCreated",editStart:"editStart",editMouseDown:"editMouseDown",editMouseMove:"editMouseMove",editMovePoint:"editMovePoint",editAddPoint:"editAddPoint",editRemovePoint:"editRemovePoint",editStyle:"editStyle",editStop:"editStop",move:"move",initialTilesLoaded:"initialTilesLoaded",allTilesLoaded:"allTilesLoaded",addTile:"addTile",addTileSuccess:"addTileSuccess",addTileError:"addTileError",removeTile:"removeTile",cameraMoveStart:"cameraMoveStart",cameraMoveEnd:"cameraMoveEnd",cameraChanged:"cameraChanged",preUpdate:"preUpdate",postUpdate:"postUpdate",preRender:"preRender",postRender:"postRender",renderError:"renderError",morphStart:"morphStart",morphComplete:"morphComplete",clockTick:"clockTick",terrainChange:"terrainChange",tileLoadProgress:"tileLoadProgress",openPopup:"openPopup",closePopup:"closePopup",destroyPopup:"destroyPopup",changePopupPosition:"changePopupPosition",showPopupElement:"showPopupElement",hidePopupElement:"hidePopupElement"},N={CREATED:"created",INITED:"inited",ADDED:"added",REMOVED:"removed",DESTROYED:"destroyed"};class G{constructor(t){var e,i,r;n(this,"originOptions"),n(this,"uuid"),n(this,"_onEventHook"),n(this,"_events"),n(this,"_eventParents"),e=this,r=0,(i=s).has(e)?a("Cannot add the same private member more than once"):i instanceof WeakSet?i.add(e):i.set(e,r),this.originOptions={...t},this.uuid=Ka()}_on(t,e,i){this._events=this._events||{};let s=this._events[t];!s&&(s=[],this._events[t]=s),i==this&&(i=void 0);const r={fn:e,ctx:i};for(let a=0,n=s.length;a<n;a++)if(s[a].fn==e&&s[a].ctx==i)return;s.push(r)}_off(t,e,i){let r,a,n;if(this._events&&(r=this._events[t],r))if(e){if(i==this&&(i=void 0),r)for(a=0,n=r.length;a<n;a++){const n=r[a];if(n.ctx==i&&n.fn==e)return n.fn=V,l(this,s)&&(this._events[t]=r=r.slice()),void r.splice(a,1)}}else{for(a=0,n=r.length;a<n;a++)r[a].fn=V;delete this._events[t]}}_propagateEvent(t){for(const e in this._eventParents)this._eventParents[e].emit(t.type,{layer:t.target,propagatedFrom:t.target,...t},!0)}destroy(t=!0){if(t)for(const e in this)delete this[e]}on(t,e,i){if(!t)return an("NOT_THROW","on: 绑定事件时传入了空值"),this;if(Array.isArray(t))for(let s=0,r=t.length;s<r;s++)this._on(t[s],e,i);else if(v(t))for(const s in t)this._on(s,t[s],i);else for(let s=0,r=(t=t.trim().split(/\s+/)).length;s<r;s++)this._on(t[s],e,i);return this._onEventHook&&this._onEventHook(t),this}off(t,e,i){if(t)if(Array.isArray(t))for(let s=0,r=t.length;s<r;s++)this._off(t[s],e,i);else if(v(t))for(const s in t)this._off(s,t[s],i);else for(let s=0,r=(t=t.trim().split(/\s+/)).length;s<r;s++)this._off(t[s],e,i);else delete this._events;return this}emit(t,e,i){if(!this.hasListener(t,i))return this;const r={type:t,target:this,sourceTarget:(null==e?void 0:e.sourceTarget)||this,data:{...e},_stopPropagation:!1,stopPropagation(){this._stopPropagation=!0}};if(this._events){const e=this._events[t];if(e){h(this,s,l(this,s)+1||1);for(let t=0,i=e.length;t<i;t++){const i=e[t];i.fn.call(i.ctx||this,r)}(a=this,n=s,{set _(t){h(a,n,t,o)},get _(){return l(a,n,c)}})._--}}var a,n,o,c;return i&&!r._stopPropagation&&this._propagateEvent(r),this}once(t,e,i){if(v(t)){for(const e in t)this.once(e,t[e],i);return this}const s=function(t,e,...i){const s=Array.prototype.slice;return t.bind?t.bind.apply(t,[e].concat(s.call(i))):function(...s){return t.apply(e,i.length>0?i.concat(s):s)}}((()=>{this.off(t,e,i).off(t,s,i)}),this);return this.on(t,e,i).on(t,s,i)}hasListener(t,e){const i=this._events&&this._events[t];if(i&&i.length)return!0;if(e)for(const s in this._eventParents)if(this._eventParents[s].hasListener(t,e))return!0;return!1}addEventParent(t){return this._eventParents=this._eventParents||{},this._eventParents[t.uuid]=t,this}removeEventParent(t){return this._eventParents&&delete this._eventParents[t.uuid],this}hasEventParent(t){return!(!this._eventParents||!this._eventParents[t.uuid])}}function V(){return!1}function j(t,e=[],i=5){if(null==t||"object"!=typeof t)return t;if(t instanceof Date)return new Date(t.getTime());if(Array.isArray(t)&&i>=0){const s=[];for(let r=0,a=t.length;r<a;++r)s[r]=j(t[r],e,i-1);return s}if("object"==typeof t&&i>=0){const s={};for(const r in t)"function"!=typeof t[r]&&(e.includes(r)||Reflect.has(t,r)&&(s[r]=j(t[r],e,i-1)));return s}return t}s=new WeakMap;function F(t,e="",i=null){const s=document.createElement(t);return s.className=e,i&&i.appendChild(s),s}function W(t,e=!1,i){const s=document.createElement("div");return i&&(s.className=i),s.innerHTML=t,e?s:s.childNodes}function q(t,e){if(!t)return!1;if(t.classList)return t.classList.contains(e);const i=t.className;return i.length>0&&new RegExp("(^|\\s)"+e+"(\\s|$)").test(i)}function B(t,e){if(t)if(t.classList){const i=e.trim().split(/\s+/);for(let e=0;e<i.length;e++)t.classList.add(i[e])}else{const i=t.className.trim(),s=(i+" "+e).trim();s!==i&&(t.className=s)}}function H(t,e){t&&(t.classList?t.classList.remove(e):q(t,e)&&(t.className=(" "+t.className+" ").replace(" "+e+" "," ").trim()))}class U extends G{constructor(t,e){super(e),n(this,"_viewer"),n(this,"_id"),n(this,"_container"),n(this,"_containerArrow"),n(this,"_containerContent"),n(this,"_containerCloseSvg"),n(this,"_currentWindowPosition"),n(this,"_currentCartesian"),n(this,"_htmlTemplate"),n(this,"_componentElement"),n(this,"_cameraCache"),n(this,"_direction"),n(this,"_contentType"),n(this,"_hasHide",!1),n(this,"emptyText","暂无数据"),n(this,"_entity"),n(this,"options"),this.options=e,this._viewer=t,this._id=u.defaultValue(e.id,this.uuid),this._direction=u.defaultValue(e.direction,"top"),this._contentType=u.defaultValue(e.contentType,"html"),this._htmlTemplate=e.htmlTemplate,this._componentElement=e.componentElement,this.emptyText=u.defaultValue(e.emptyText,"暂无数据"),this.setEntity(this.options.entity),this._initContainer(),this._bindPostRender()}get id(){return this._id}get container(){return this._container}get viewerContainer(){var t;return null==(t=this._viewer)?void 0:t.container}get direction(){return this._direction}set direction(t){this._direction=t,this._setDivPosition()}get currentWindowPosition(){return this._currentWindowPosition}set currentWindowPosition(t){this._currentWindowPosition=t,this._setDivPosition()}get currentCartesian(){return this._currentCartesian}set currentCartesian(t){this._currentCartesian=t,this._setEntityPosition()}get entity(){return this._entity}set entity(t){this.setEntity(t)}_initContainer(){"html"==this._contentType&&(this._container=F("div","pie3d-popup"),this._container.setAttribute("uuid",this.uuid),this._container.setAttribute("id","pie3d-popup-"+this.id),this._container.style.display="none",this._containerArrow=F("div","pie3d-popup-arrow pie3d-popup-rightArrow",this._container),this._containerContent=F("div","pie3d-popup-inner",this._container),this._containerCloseSvg=W('<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24"><path fill="currentColor" d="M6.4 19L5 17.6l5.6-5.6L5 6.4L6.4 5l5.6 5.6L17.6 5L19 6.4L13.4 12l5.6 5.6l-1.4 1.4l-5.6-5.6z"/></svg>')[0],this._containerCloseSvg.classList.add("pie3d-popup-close"),this._container.append(this._containerCloseSvg),this._containerCloseSvg.addEventListener("click",(t=>{this.close()})),this.viewerContainer.appendChild(this._container))}setEntity(t){var e,i;const s=(null==(e=this._entity)?void 0:e.show)??!1,r=(null==(i=this._entity)?void 0:i.position)??u.Cartesian3.ZERO;this._entity&&this._viewer.entities.remove(this._entity),t&&(this._entity=t instanceof u.Entity?t:v(t)?new u.Entity(t):new u.Entity({id:"pie3d-popup-entity-"+this.id,position:u.Cartesian3.ZERO,billboard:{image:"",verticalOrigin:u.VerticalOrigin.TOP}}),this._entity.show=s,this._entity.position=r,this._viewer.entities.add(this._entity))}_bindPostRender(){this._viewer.scene.postRender.addEventListener(this._render,this)}_unbindPostRender(){this._viewer.scene.postRender.removeEventListener(this._render,this)}_render(){var t,e,i,s;if(!this.currentCartesian)return;const r=this.currentCartesian,a=this._viewer.scene,n="html"==this._contentType?(null==(t=this._container)?void 0:t.clientHeight)??0:"component"==this._contentType?(null==(e=this._componentElement)?void 0:e.clientHeight)??0:0,o="html"==this._contentType?(null==(i=this._container)?void 0:i.clientWidth)??0:"component"==this._contentType?(null==(s=this._componentElement)?void 0:s.clientWidth)??0:0;if(this._isUnchange(o,n))return;if(a.mode==u.SceneMode.SCENE3D){if(!new u.EllipsoidalOccluder(a.globe.ellipsoid,a.camera.positionWC).isPointVisible(r))return this._container&&(this._container.style.display="none"),void(this._componentElement&&(this._componentElement.style.display="none"))}this._container&&(this._container.style.display=this._hasHide?"none":"block"),this._componentElement&&(this._componentElement.style.display=this._hasHide?"none":"block");const l=u.SceneTransforms.worldToWindowCoordinates(a,r)??this._currentWindowPosition;this.currentWindowPosition=l}_isUnchange(t,e){var i,s,r;const a=this._viewer.scene.camera,n={x:null==(i=this._currentCartesian)?void 0:i.x,y:null==(s=this._currentCartesian)?void 0:s.y,z:null==(r=this._currentCartesian)?void 0:r.z,p1:t,p2:e,p3:a.positionWC.x,p4:a.positionWC.y,p5:a.positionWC.z,p6:a.heading,p7:a.pitch,p8:a.roll};return!(!this._cameraCache||n.x!=this._cameraCache.x||n.x!=this._cameraCache.x||n.y!=this._cameraCache.y||n.z!=this._cameraCache.z||n.p1!=this._cameraCache.p1||n.p2!=this._cameraCache.p2||n.p3!=this._cameraCache.p3||n.p4!=this._cameraCache.p4||n.p5!=this._cameraCache.p5||n.p6!=this._cameraCache.p6||n.p7!=this._cameraCache.p7||n.p8!=this._cameraCache.p8)||(this._cameraCache=n,!1)}_setDivPosition(){var t,e,i,s;if(!this._currentWindowPosition)return;const r={top:"unset",left:"unset",right:"unset",bottom:"unset"},a="html"==this._contentType?(null==(t=this._container)?void 0:t.clientHeight)??0:"component"==this._contentType?(null==(e=this._componentElement)?void 0:e.clientHeight)??0:0,n="html"==this._contentType?(null==(i=this._container)?void 0:i.clientWidth)??0:"component"==this._contentType?(null==(s=this._componentElement)?void 0:s.clientWidth)??0:0;"right"==this.direction?(r.top=this._currentWindowPosition.y-a/2+"px",r.left=this._currentWindowPosition.x+n+"px"):"left"==this.direction?(r.top=this._currentWindowPosition.y-a/2+"px",r.left=this._currentWindowPosition.x-n+"px"):"top"==this.direction?(r.left=this._currentWindowPosition.x-n/2+"px",r.top=this._currentWindowPosition.y-a+"px"):"bottom"==this.direction&&(r.left=this._currentWindowPosition.x-n/2+"px",r.top=this._currentWindowPosition.y+a+"px"),"component"==this._contentType&&this._componentElement&&(this._componentElement.style.top=r.top,this._componentElement.style.left=r.left),"html"==this._contentType&&this._container&&(this._container.style.top=r.top,this._container.style.left=r.left,this._containerArrow&&("right"==this.direction?(B(this._containerArrow,"pie3d-popup-rightArrow"),H(this._containerArrow,"pie3d-popup-leftArrow"),H(this._containerArrow,"pie3d-popup-topArrow"),H(this._containerArrow,"pie3d-popup-bottomArrow")):"left"==this.direction?(B(this._containerArrow,"pie3d-popup-leftArrow"),H(this._containerArrow,"pie3d-popup-rightArrow"),H(this._containerArrow,"pie3d-popup-topArrow"),H(this._containerArrow,"pie3d-popup-bottomArrow")):"top"==this.direction?(B(this._containerArrow,"pie3d-popup-topArrow"),H(this._containerArrow,"pie3d-popup-rightArrow"),H(this._containerArrow,"pie3d-popup-leftArrow"),H(this._containerArrow,"pie3d-popup-bottomArrow")):"bottom"==this.direction&&(B(this._containerArrow,"pie3d-popup-bottomArrow"),H(this._containerArrow,"pie3d-popup-rightArrow"),H(this._containerArrow,"pie3d-popup-leftArrow"),H(this._containerArrow,"pie3d-popup-topArrow")))),this.emit("changePopupPosition",{id:this.id,popup:this,pos:{direction:this.direction,...r}})}_setEntityPosition(){this._entity&&this._currentCartesian&&(this._entity.position=this._currentCartesian)}hidePopupElement(){this._cameraCache=void 0,this._hasHide=!0,this._container&&(this._container.style.display="none"),this._componentElement&&(this._componentElement.style.display="none"),this.emit("hidePopupElement",{id:this.id,popup:this})}showPopupElement(){this._cameraCache=void 0,this._hasHide=!1,this._container&&(this._container.style.display="block"),this._componentElement&&(this._componentElement.style.display="block"),this.emit("showPopupElement",{id:this.id,popup:this})}async open(t,e){var i,s;this._entity&&(this._entity.show=!0),t instanceof u.Cartesian3?this.currentCartesian=t:t instanceof u.Cartesian2?this.currentCartesian=new u.Cartesian3(t.x,t.y,0):this.currentCartesian=this.currentCartesian??u.Cartesian3.ZERO;const r=e??await(null==(s=(i=this.options).getData)?void 0:s.call(i,this.currentCartesian))??this.emptyText;if(this._containerContent)if(this._containerContent.innerHTML="",v(r)&&this._htmlTemplate){const t=I(this._htmlTemplate,r,!0);this._containerContent.innerHTML=t.toString()}else this._containerContent.innerHTML=r.toString();this.showPopupElement(),this.currentWindowPosition=u.SceneTransforms.worldToWindowCoordinates(this._viewer.scene,this.currentCartesian)??u.Cartesian2.ZERO,this.emit("openPopup",{id:this.id,popup:this,info:{showData:r,cartesian:this.currentCartesian,windowPosition:this.currentWindowPosition}})}close(){this.hidePopupElement(),this._entity&&(this._entity.show=!1),this.emit("closePopup",{id:this.id,popup:this})}destroy(){this.close(),this._container&&this._container.parentNode&&this.viewerContainer.removeChild(this._container),this._entity&&(this._viewer.entities.remove(this._entity),this._entity=void 0),this._unbindPostRender(),this.emit("destroyPopup",{id:this.id,popup:this}),super.destroy(!0)}emit(t,e){return super.emit(t,e,!0)}on(t,e,i){return super.on(t,e,i)}off(t,e,i){return super.off(t,e,i)}}n(U,"EventType",{...f(D,["openPopup","closePopup","destroyPopup","changePopupPosition","showPopupElement","hidePopupElement"])});class K extends G{constructor(t={}){super(t),n(this,"_show"),n(this,"_state",N.CREATED),n(this,"_initCompleted"),n(this,"_eventCacheSet",new Set),n(this,"_popup"),n(this,"_earth"),n(this,"options"),n(this,"parent"),this.options=t,this.options.id=u.defaultValue(t.id,this.uuid),this.options.pid=u.defaultValue(t.pid,-1),this.options.name=u.defaultValue(t.name,this.uuid),this._show=u.defaultValue(t.show,!0),this.options.onClick=u.defaultValue(this.options.onClick,((t,e)=>{var i;null==(i=t.popup)||i.open(e.data.cartesian)})),this.bindClickEvent(this.options.onClick),this.on(D.click,(t=>{this._eventCacheSet.forEach((e=>{e(this,t)}))}))}get id(){return this.options.id}get pid(){return this.options.pid}get name(){return this.options.name}get earth(){return this._earth}get viewer(){var t;return null==(t=this._earth)?void 0:t.viewer}get popup(){return this._popup}get type(){return this._type}get state(){return this._state}get show(){return this._show}set show(t){this.setShow(t)}async _onAdd(t){this._state!=N.ADDED&&(this._earth=t,!1!==this.options.eventParent&&(this.options.eventParent?this.addEventParent(this.options.eventParent):this.addEventParent(t)),!this._initCompleted&&(this._initHooks(),u.defined(this.options.popup)&&this.bindPopup(this.viewer,this.options.popup),this._initCompleted=!0,this._state=N.INITED),await this._addHooks(),this._state=N.ADDED,this.options.flyTo&&this.flyTo(),this.emit(D.add,{layer:this},!0),this.emit(D.addLayer,{layer:this},!0))}_onRemove(){this._state!=N.REMOVED&&this._earth&&(this._removeHooks(),this._state=N.REMOVED,this.emit(D.remove,{layer:this},!0),this.emit(D.removeLayer,{layer:this},!0),this.options.eventParent?this.removeEventParent(this.options.eventParent):!1===this.options.eventParent||this.removeEventParent(this._earth),this._earth=void 0)}setShow(t){this._show!=t&&this._state!=N.DESTROYED&&(this.options.show=t,this._show=t,this.layerSource&&(Array.isArray(this.layerSource)?this.layerSource.forEach((e=>{e.show=t})):this.layerSource.show=t),this.state==N.ADDED&&(this._showHooks(t),t?this.emit(D.show,{layer:this},!0):this.emit(D.hide,{layer:this},!0)))}flyTo(t){if(this._earth)if(this._earth.cancelFlyTo(),this.options.homeVision)this._earth.flyTo({...this.options.homeVision,...t});else if(this.getRectangle){const e=this.getRectangle(!0);e&&this._earth.flyToExtent(e,{...t})}else this.options.onCenterAt&&this.options.onCenterAt(t)}toJSON(){const t=j(this.options,["parent","eventParent"]);return t.type=this.type,t.show=this.show,this._toJsonHooks(t),t}addTo(t){t&&t.addLayer&&t.addLayer(this)}removeTo(t=!0){this._earth&&this._earth.removeLayer(this,t)}addedPromise(){return new Promise((t=>{let e=setInterval((()=>{this.state==N.ADDED&&(clearInterval(e),e=void 0,t(this))}),100)}))}bindClickEvent(t){!this._eventCacheSet.has(t)&&this._eventCacheSet.add(t)}unbindClickEvent(t){t?this._eventCacheSet.has(t)&&this._eventCacheSet.delete(t):this._eventCacheSet.clear()}bindPopup(t,e){var i;t?(null==(i=this._popup)||i.destroy(),this._popup=new U(t,e),this._popup.addEventParent(this)):an("NOT_THROW","绑定弹窗需要传入Cesium.Viewer实例")}unbindPopup(){var t;null==(t=this._popup)||t.destroy(),this._popup=void 0}destroy(){this._state!=N.REMOVED&&this.removeTo(),this._destroyHooks(),super.destroy(),this._state=N.DESTROYED}}n(K,"EventType",{...f(D,["add","addLayer","remove","removeLayer","show","hide"]),...U.EventType});const Z={};function X(t,e){Z[t]&&an("NOT_THROW","registerOptsConver: "+t+"类型已存在"),Z[t]=e}const J={};function Y(t,e){J[t]&&an("NOT_THROW","registerMaterial: "+t+"类型已存在"),J[t]=e}const Q={};function $(t,e){Q[t]&&an("NOT_THROW","registerProperty: "+t+"属性类型已存在"),Q[t]=e}function tt(t,e){if(!t)return void an("NOT_THROW","createMaterial：请指定MaterialType类型");const i=Z[t]||Z.default;let s;i&&(e.materialType=t,e=i.toCesiumVal(e));const r=J[t];return s=r?new r(e):u.Material.fromType(t,e),s.options=e,s._pie3d_type=t,s}function et(t,e){const i=Q[t];if(i){const s=Z[t]||Z.default;s&&(e.materialType=t,e=s.toCesiumVal(e,{},!0));const r=new i(e);return r._pie3d_type=t,r.options=e,r}an("NOT_THROW","createMaterialProperty: 未找到该类型的对应材质属性")}function it(t,e={}){var i;let s;t._pie3d_type?s=t._pie3d_type:(null==(i=null==t?void 0:t._template)?void 0:i.type)?s=t._template.type:(null==t?void 0:t.getType)&&(s=t.getType()),!s&&(t instanceof u.Color?s="Color":an("NOT_THROW","toJSON: 未识别的材质类型"));const r=Z[s]||Z.default;return r&&(e.materialType=s,r.toJSON(t,e)),e}const st=Object.freeze(Object.defineProperty({__proto__:null,createMaterial:tt,createMaterialProperty:et,registerMaterial:Y,registerOptsConver:X,registerProperty:$,toJSON:it},Symbol.toStringTag,{value:"Module"}));class rt extends K{constructor(t){super(t),n(this,"_type","colorPatternGradient"),n(this,"_primitiveCollection"),n(this,"_colorPatternGradientPrimitive"),n(this,"_colorRamp"),n(this,"_rectangle"),n(this,"_aboveGround"),n(this,"_height"),n(this,"_uniforms"),n(this,"options"),this.options=t,!t.colorRamp&&an("THROW",'Constructor: 构造参数未传入色带数组 "colorRamp"，该项为必传项'),this._colorRamp=t.colorRamp,this._aboveGround=u.defaultValue(this.options.aboveGround,!1),this._height=u.defaultValue(this.options.height,0),this._rectangle=ya(this.options.rectangle)??u.Rectangle.MAX_VALUE,!t.uniformOptions.image&&an("THROW",'Constructor: 构造参数未传入数值预报查询图片接口返回的基础图片 "uniformOptions.image"，该项为必传项'),this._uniforms=this._createUniforms(this.options.uniformOptions)}get isTile(){return!1}get layerSource(){return this._primitiveCollection}get rectangle(){return this._rectangle}get colorRamp(){return this._colorRamp}set colorRamp(t){this.setColorRamp(t)}async _initHooks(){!this._primitiveCollection&&(this._primitiveCollection=new u.PrimitiveCollection,this._primitiveCollection.show=this.show)}async _addHooks(){this._colorPatternGradientPrimitive=this._createColorPatternGradientPrimitive(),this._primitiveCollection.add(this._colorPatternGradientPrimitive),this._earth.viewer.scene.primitives.add(this._primitiveCollection)}_removeHooks(){var t;null==(t=this._earth)||t.viewer.scene.primitives.remove(this._primitiveCollection)}_destroyHooks(){var t;null==(t=this._primitiveCollection)||t.removeAll()}_showHooks(t){}_toJsonHooks(t){}_getImgByColorRamp(t,e,i,s){const r=document.createElement("canvas"),a=r.getContext("2d");if(a){if(r.width=256,r.height=8,"linear"!==s){const s=a.createLinearGradient(0,0,256,0);i.forEach((i=>{const{value:r,color:a}=i;s.addColorStop((r-t)/(e-t),a)})),a.fillStyle=s,a.fillRect(0,0,256,8)}else{let s=0;i.forEach(((i,r,n)=>{const{value:o,color:l}=i,h=(o-t)/(e-t)*256;a.fillStyle=l,a.fillRect(s,0,h-s,8),s=h,r===n.length-1&&a.fillRect(h,0,256-h,8)}))}return r.toDataURL("image/png")}}_createUniforms(t){const e=u.defaultValue(t.alpha,.8),i=u.defaultValue(t.resultSize,new u.Cartesian2(2880,1440)),s=this._colorRamp.sort(((t,e)=>t.value-e.value))[0].value,r=this._colorRamp.sort(((t,e)=>e.value-t.value))[0].value,a=rn("THROW","getImgByColorRamp: 生成基于颜色映射的图像失败",(()=>this._getImgByColorRamp(s,r,this._colorRamp)));return{u_image:t.image,u_colorImage:a,u_minValue:s,u_maxValue:r,u_alpha:e,u_resultSize:i}}_createColorPatternGradientPrimitive(){const t=new(this._aboveGround?u.GroundPrimitive:u.Primitive)({geometryInstances:new u.GeometryInstance({geometry:new u.RectangleGeometry({ellipsoid:u.Ellipsoid.WGS84,height:this._aboveGround?0:this._height,rectangle:this._rectangle,vertexFormat:u.EllipsoidSurfaceAppearance.VERTEX_FORMAT})}),appearance:new u.EllipsoidSurfaceAppearance({aboveGround:this._aboveGround})}),e=tt(se.ColorPatternGradient,{...this._uniforms});return e&&(t.appearance.material=e),t._pie3d_layerId=this.uuid,t}getRectangle(t){const e=this._rectangle??u.Rectangle.MAX_VALUE;return!0===t?_a(e):e}getLegendImage(){const t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return;const i=256/this._colorRamp.length,s="10px serif",r="white";let a=256,n=20,o=!1;const l=Math.PI/4;for(let h=0;h<this._colorRamp.length;h++){e.font=s;const t=this._colorRamp[h].value.toString();if(o=e.measureText(t).width>i,o){a=270,n=45;break}}t.width=a,t.height=n;for(let h=0;h<this._colorRamp.length;h++)if(e.fillStyle=this._colorRamp[h].color,e.fillRect(h*i,0,i,8),h<this._colorRamp.length-1){e.save();let t=(h+1)*i,a=18;const n=this._colorRamp[h].value.toString();let c=0;if(o)e.translate(t,a),e.rotate(l),t=0,a=0,c=5;else{c=e.measureText(n).width/2}this._colorRamp.length>20?h%3==0&&(e.fillStyle=r,e.font=s,e.fillText(n,t-c,a)):(e.fillStyle=r,e.font=s,e.fillText(n,t-c,a)),e.restore()}return t.toDataURL("image/png")}setColorRamp(t){this._colorRamp=t;const e=this._colorRamp.sort(((t,e)=>t.value-e.value))[0].value,i=this._colorRamp.sort(((t,e)=>e.value-t.value))[0].value,s=rn("THROW","getImgByColorRamp: 生成基于颜色映射的图像失败",(()=>this._getImgByColorRamp(e,i,this._colorRamp)));this._colorPatternGradientPrimitive&&(this._colorPatternGradientPrimitive.appearance.material.uniforms.u_minValue=e,this._colorPatternGradientPrimitive.appearance.material.uniforms.u_maxValue=i,this._colorPatternGradientPrimitive.appearance.material.uniforms.u_colorImage=s)}setUniforms(t){Reflect.ownKeys(t).forEach((e=>{this._uniforms["u_"+e]=t[e],this._colorPatternGradientPrimitive&&(this._colorPatternGradientPrimitive.appearance.material.uniforms["u_"+e]=this._uniforms["u_"+e])}))}}function at(t,e="utf8"){return new TextDecoder(e).decode(t)}n(rt,"EventType",{...K.EventType}),function(t){if(t.TextEncoder&&t.TextDecoder)return!1;function e(t="utf-8"){if("utf-8"!==t)throw new RangeError("Failed to construct 'TextEncoder': The encoding label provided ('"+t+"') is invalid.")}function i(t="utf-8",e={fatal:!1}){if("utf-8"!==t)throw new RangeError("Failed to construct 'TextDecoder': The encoding label provided ('"+t+"') is invalid.");if(e.fatal)throw new Error("Failed to construct 'TextDecoder': the 'fatal' option is unsupported.")}Object.defineProperty(e.prototype,"encoding",{value:"utf-8"}),e.prototype.encode=function(t,e={stream:!1}){if(e.stream)throw new Error("Failed to encode: the 'stream' option is unsupported.");let i=0;const s=t.length;let r=0,a=Math.max(32,s+(s>>1)+7),n=new Uint8Array(a>>3<<3);for(;i<s;){let e=t.charCodeAt(i++);if(e>=55296&&e<=56319){if(i<s){const s=t.charCodeAt(i);56320==(64512&s)&&(++i,e=((1023&e)<<10)+(1023&s)+65536)}if(e>=55296&&e<=56319)continue}if(r+4>n.length){a+=8,a*=1+i/t.length*2,a=a>>3<<3;const e=new Uint8Array(a);e.set(n),n=e}if(4294967168&e){if(4294965248&e)if(4294901760&e){if(4292870144&e)continue;n[r++]=e>>18&7|240,n[r++]=e>>12&63|128,n[r++]=e>>6&63|128}else n[r++]=e>>12&15|224,n[r++]=e>>6&63|128;else n[r++]=e>>6&31|192;n[r++]=63&e|128}else n[r++]=e}return n.slice(0,r)},Object.defineProperty(i.prototype,"encoding",{value:"utf-8"}),Object.defineProperty(i.prototype,"fatal",{value:!1}),Object.defineProperty(i.prototype,"ignoreBOM",{value:!1}),i.prototype.decode=function(t,e={stream:!1}){if(e.stream)throw new Error("Failed to decode: the 'stream' option is unsupported.");const i=new Uint8Array(t);let s=0;const r=i.length,a=[];for(;s<r;){const t=i[s++];if(0===t)break;if(128&t){if(192==(224&t)){const e=63&i[s++];a.push((31&t)<<6|e)}else if(224==(240&t)){const e=63&i[s++],r=63&i[s++];a.push((31&t)<<12|e<<6|r)}else if(240==(248&t)){let e=(7&t)<<18|(63&i[s++])<<12|(63&i[s++])<<6|63&i[s++];e>65535&&(e-=65536,a.push(e>>>10&1023|55296),e=56320|1023&e),a.push(e)}}else a.push(t)}return String.fromCharCode.apply(null,a)},t.TextEncoder=e,t.TextDecoder=i}("undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0);const nt=new TextEncoder;const ot=(()=>{const t=new Uint8Array(4);return!((new Uint32Array(t.buffer)[0]=1)&t[0])})(),lt={int8:globalThis.Int8Array,uint8:globalThis.Uint8Array,int16:globalThis.Int16Array,uint16:globalThis.Uint16Array,int32:globalThis.Int32Array,uint32:globalThis.Uint32Array,uint64:globalThis.BigUint64Array,int64:globalThis.BigInt64Array,float32:globalThis.Float32Array,float64:globalThis.Float64Array};class ht{constructor(t=8192,e={}){let i=!1;"number"==typeof t?t=new ArrayBuffer(t):(i=!0,this.lastWrittenByte=t.byteLength);const s=e.offset?e.offset>>>0:0,r=t.byteLength-s;let a=s;(ArrayBuffer.isView(t)||t instanceof ht)&&(t.byteLength!==t.buffer.byteLength&&(a=t.byteOffset+s),t=t.buffer),this.lastWrittenByte=i?r:0,this.buffer=t,this.length=r,this.byteLength=r,this.byteOffset=a,this.offset=0,this.littleEndian=!0,this._data=new DataView(this.buffer,a,r),this._mark=0,this._marks=[]}available(t=1){return this.offset+t<=this.length}isLittleEndian(){return this.littleEndian}setLittleEndian(){return this.littleEndian=!0,this}isBigEndian(){return!this.littleEndian}setBigEndian(){return this.littleEndian=!1,this}skip(t=1){return this.offset+=t,this}back(t=1){return this.offset-=t,this}seek(t){return this.offset=t,this}mark(){return this._mark=this.offset,this}reset(){return this.offset=this._mark,this}pushMark(){return this._marks.push(this.offset),this}popMark(){const t=this._marks.pop();if(void 0===t)throw new Error("Mark stack empty");return this.seek(t),this}rewind(){return this.offset=0,this}ensureAvailable(t=1){if(!this.available(t)){const e=2*(this.offset+t),i=new Uint8Array(e);i.set(new Uint8Array(this.buffer)),this.buffer=i.buffer,this.length=this.byteLength=e,this._data=new DataView(this.buffer)}return this}readBoolean(){return 0!==this.readUint8()}readInt8(){return this._data.getInt8(this.offset++)}readUint8(){return this._data.getUint8(this.offset++)}readByte(){return this.readUint8()}readBytes(t=1){return this.readArray(t,"uint8")}readArray(t,e){const i=lt[e].BYTES_PER_ELEMENT*t,s=this.byteOffset+this.offset,r=this.buffer.slice(s,s+i);if(this.littleEndian===ot&&"uint8"!==e&&"int8"!==e){const t=new Uint8Array(this.buffer.slice(s,s+i));t.reverse();const r=new lt[e](t.buffer);return this.offset+=i,r.reverse(),r}const a=new lt[e](r);return this.offset+=i,a}readInt16(){const t=this._data.getInt16(this.offset,this.littleEndian);return this.offset+=2,t}readUint16(){const t=this._data.getUint16(this.offset,this.littleEndian);return this.offset+=2,t}readInt32(){const t=this._data.getInt32(this.offset,this.littleEndian);return this.offset+=4,t}readUint32(){const t=this._data.getUint32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat32(){const t=this._data.getFloat32(this.offset,this.littleEndian);return this.offset+=4,t}readFloat64(){const t=this._data.getFloat64(this.offset,this.littleEndian);return this.offset+=8,t}readBigInt64(){const t=this._data.getBigInt64(this.offset,this.littleEndian);return this.offset+=8,t}readBigUint64(){const t=this._data.getBigUint64(this.offset,this.littleEndian);return this.offset+=8,t}readChar(){return String.fromCharCode(this.readInt8())}readChars(t=1){let e="";for(let i=0;i<t;i++)e+=this.readChar();return e}readUtf8(t=1){return at(this.readBytes(t))}decodeText(t=1,e="utf-8"){return at(this.readBytes(t),e)}writeBoolean(t){return this.writeUint8(t?255:0),this}writeInt8(t){return this.ensureAvailable(1),this._data.setInt8(this.offset++,t),this._updateLastWrittenByte(),this}writeUint8(t){return this.ensureAvailable(1),this._data.setUint8(this.offset++,t),this._updateLastWrittenByte(),this}writeByte(t){return this.writeUint8(t)}writeBytes(t){this.ensureAvailable(t.length);for(let e=0;e<t.length;e++)this._data.setUint8(this.offset++,t[e]);return this._updateLastWrittenByte(),this}writeInt16(t){return this.ensureAvailable(2),this._data.setInt16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeUint16(t){return this.ensureAvailable(2),this._data.setUint16(this.offset,t,this.littleEndian),this.offset+=2,this._updateLastWrittenByte(),this}writeInt32(t){return this.ensureAvailable(4),this._data.setInt32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeUint32(t){return this.ensureAvailable(4),this._data.setUint32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat32(t){return this.ensureAvailable(4),this._data.setFloat32(this.offset,t,this.littleEndian),this.offset+=4,this._updateLastWrittenByte(),this}writeFloat64(t){return this.ensureAvailable(8),this._data.setFloat64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigInt64(t){return this.ensureAvailable(8),this._data.setBigInt64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeBigUint64(t){return this.ensureAvailable(8),this._data.setBigUint64(this.offset,t,this.littleEndian),this.offset+=8,this._updateLastWrittenByte(),this}writeChar(t){return this.writeUint8(t.charCodeAt(0))}writeChars(t){for(let e=0;e<t.length;e++)this.writeUint8(t.charCodeAt(e));return this}writeUtf8(t){return this.writeBytes(function(t){return nt.encode(t)}(t))}toArray(){return new Uint8Array(this.buffer,this.byteOffset,this.lastWrittenByte)}_updateLastWrittenByte(){this.offset>this.lastWrittenByte&&(this.lastWrittenByte=this.offset)}}const ct=1,ut=2,dt=3,pt=4,mt=5,ft=6;function _t(t){switch(Number(t)){case ct:return"byte";case ut:return"char";case dt:return"short";case pt:return"int";case mt:return"float";case ft:return"double";default:return"undefined"}}function yt(t){switch(Number(t)){case ct:case ut:return 1;case dt:return 2;case pt:case mt:return 4;case ft:return 8;default:return-1}}function gt(t){switch(String(t)){case"byte":return ct;case"char":return ut;case"short":return dt;case"int":return pt;case"float":return mt;case"double":return ft;default:return-1}}function vt(t,e){if(1!==t){const i=new Array(t);for(let s=0;s<t;s++)i[s]=e();return i}return e()}function Mt(t,e,i){switch(e){case ct:return Array.from(t.readBytes(i));case ut:return function(t){return 0===t.charCodeAt(t.length-1)?t.substring(0,t.length-1):t}(t.readChars(i));case dt:return vt(i,t.readInt16.bind(t));case pt:return vt(i,t.readInt32.bind(t));case mt:return vt(i,t.readFloat32.bind(t));case ft:return vt(i,t.readFloat64.bind(t));default:throw new Error("non valid type "+e)}}function Ct(t,e){if(t)throw new TypeError("Not a valid NetCDF v3.x file: "+e)}function xt(t){t.offset%4!=0&&t.skip(4-t.offset%4)}function bt(t){const e=t.readUint32(),i=t.readChars(e);return xt(t),i}function wt(t,e){const i={version:e},s={length:t.readUint32()},r=function(t){const e={};let i,s;const r=t.readUint32();let a;if(0===r)return Ct(0!==t.readUint32(),"wrong empty tag for list of dimensions"),[];{Ct(10!==r,"wrong tag for list of dimensions");const e=t.readUint32();a=new Array(e);for(let r=0;r<e;r++){const e=bt(t),n=t.readUint32();0===n&&(i=r,s=e),a[r]={name:e,size:n}}}return void 0!==i&&(e.recordId=i),void 0!==s&&(e.recordName=s),e.dimensions=a,e}(t);!Array.isArray(r)&&(s.id=r.recordId,s.name=r.recordName,i.dimensions=r.dimensions),i.globalAttributes=Pt(t);const a=function(t,e,i){const s=t.readUint32();let r,a=0;if(0===s)return Ct(0!==t.readUint32(),"wrong empty tag for list of variables"),[];{Ct(11!==s,"wrong tag for list of variables");const n=t.readUint32();r=new Array(n);for(let s=0;s<n;s++){const n=bt(t),o=t.readUint32(),l=new Array(o);for(let e=0;e<o;e++)l[e]=t.readUint32();const h=Pt(t),c=t.readUint32();Ct(c<1&&c>6,"non valid type "+c);const u=t.readUint32();let d=t.readUint32();2===i&&(Ct(d>0,"offsets larger than 4GB not supported"),d=t.readUint32());let p=!1;void 0!==e&&l[0]===e&&(a+=u,p=!0),r[s]={name:n,dimensions:l,attributes:h,type:_t(c),size:u,offset:d,record:p}}}return{variables:r,recordStep:a}}(t,null==s?void 0:s.id,e);return!Array.isArray(a)&&(i.variables=a.variables,s.recordStep=a.recordStep),i.recordDimension=s,i}function Pt(t){const e=t.readUint32();let i;if(0===e)return Ct(0!==t.readUint32(),"wrong empty tag for list of attributes"),[];{Ct(12!==e,"wrong tag for list of attributes");const s=t.readUint32();i=new Array(s);for(let e=0;e<s;e++){const s=bt(t),r=t.readUint32();Ct(r<1||r>6,"non valid type "+r);const a=t.readUint32(),n=Mt(t,r,a);xt(t),i[e]={name:s,type:_t(r),value:n}}}return i}function St(){const t=[];t.push("DIMENSIONS");for(const i of this.dimensions)t.push("  "+i.name.padEnd(30)+" = size: "+i.size);t.push(""),t.push("GLOBAL ATTRIBUTES");for(const i of this.globalAttributes)t.push("  "+i.name.padEnd(30)+" = "+i.value);const e=JSON.parse(JSON.stringify(this.variables));t.push(""),t.push("VARIABLES:");for(const i of e){i.value=this.getDataVariable(i);let e=JSON.stringify(i.value);e.length>50&&(e=e.substring(0,50)),!isNaN(i.value.length)&&(e+=" (length: "+i.value.length+")"),t.push("  "+i.name.padEnd(30)+" = "+e)}return t.join("\n")}class Tt{constructor(t){this.toString=St;const e=new ht(t);e.setBigEndian(),Ct("CDF"!==e.readChars(3),"should start with CDF");const i=e.readByte();Ct(i>2,"unknown version"),this.header=wt(e,i),this.buffer=e}get version(){return 1===this.header.version?"classic format":"64-bit offset format"}get recordDimension(){return this.header.recordDimension}get dimensions(){return this.header.dimensions}get globalAttributes(){return this.header.globalAttributes}getAttribute(t){const e=this.globalAttributes.find((e=>e.name===t));return e?e.value:null}getDataVariableAsString(t){const e=this.getDataVariable(t);return e?e.join(""):null}get variables(){return this.header.variables}getDataVariable(t){let e;if(e="string"==typeof t?this.header.variables.find((e=>e.name===t)):t,void 0===e)throw new Error("Not a valid NetCDF v3.x file: variable not found");return this.buffer.seek(e.offset),e.record?function(t,e,i){const s=gt(e.type),r=e.size?e.size/yt(s):1,a=i.length,n=new Array(a),o=i.recordStep;if(!o)throw new Error("recordDimension.recordStep is undefined");for(let l=0;l<a;l++){const e=t.offset;n[l]=Mt(t,s,r),t.seek(e+o)}return n}(this.buffer,e,this.header.recordDimension):function(t,e){const i=gt(e.type),s=e.size/yt(i),r=new Array(s);for(let a=0;a<s;a++)r[a]=Mt(t,i,1);return r}(this.buffer,e)}dataVariableExists(t){return void 0!==this.header.variables.find((e=>e.name===t))}attributeExists(t){return void 0!==this.globalAttributes.find((e=>e.name===t))}}const Et="IWZ1bmN0aW9uKCl7InVzZSBzdHJpY3QiO3NlbGYub25tZXNzYWdlPXM9Pntjb25zdHtkYXRhOmV9PXMsdD1lLnNpemVbMF0sbz1lLnNpemVbMV0sbj1lLmF0dHJpYnV0ZXMucG9zaXRpb24udmFsdWVzLGk9ZS5hdHRyaWJ1dGVzLm5vcm1hbC52YWx1ZXMscj1lLmF0dHJpYnV0ZXMuc3QudmFsdWVzLGw9ZS5zb3VyY2Uuc2xpY2UoMCxlLnNpemVbMF0qZS5zaXplWzFdKSxhPWUuaW5kaWNlcyx1PVtdLGM9W10sZj1bXSxoPVtdLHA9W107Zm9yKGxldCB3PTA7dzxvO3crKylmb3IobGV0IHM9MDtzPHQ7cysrKXtjb25zdCBlPXMrdyp0LG89YS5zbGljZSg2KmUsNiplKzYpLGc9bFtlXSxtPVtnLGcsZyxnXSx6PUFycmF5LmZyb20obmV3IFNldChvKSk7aC5wdXNoKC4uLm0pLHouZm9yRWFjaCgocz0+e2NvbnN0IGU9W25bMypzXSxuWzMqcysxXSxuWzMqcysyXV0sdD1baVszKnNdLGlbMypzKzFdLGlbMypzKzJdXSxvPVtyWzIqc10sclsyKnMrMV1dO3UucHVzaCguLi5lKSxjLnB1c2goLi4udCksZi5wdXNoKC4uLm8pfSkpO2NvbnN0IGI9dS5sZW5ndGgvMztwLnB1c2goYi00LGItMixiLTMsYi0zLGItMixiLTEpfXNlbGYucG9zdE1lc3NhZ2Uoe25ld1Bvc2l0aW9uczp1LG5ld05vcm1hbHM6YyxuZXdTdHM6ZixuZXdDb2xvcnM6aCxuZXdJbmRpY2VzOnB9KX0sc2VsZi5vbmVycm9yPXM9PmNvbnNvbGUubG9nKHMpfSgpOwo=",kt="undefined"!=typeof self&&self.Blob&&new Blob([(It=Et,Uint8Array.from(atob(It),(t=>t.charCodeAt(0))))],{type:"text/javascript;charset=utf-8"});var It;function Lt(t){let e;try{if(e=kt&&(self.URL||self.webkitURL).createObjectURL(kt),!e)throw"";const i=new Worker(e,{name:null==t?void 0:t.name});return i.addEventListener("error",(()=>{(self.URL||self.webkitURL).revokeObjectURL(e)})),i}catch(i){return new Worker("data:text/javascript;base64,"+Et,{name:null==t?void 0:t.name})}finally{e&&(self.URL||self.webkitURL).revokeObjectURL(e)}}const At=[{color:"#00FF00",value:.5},{color:"#FFFF00",value:2},{color:"#FF0000",value:6}],Ot=class t extends G{constructor(e){super(e),n(this,"_maxVal"),n(this,"_minVal"),n(this,"_alpha",1),n(this,"_interval",.5),n(this,"_heightScale",1),n(this,"_extent",[90,0,150,50]),n(this,"_size",[0,0,0]),n(this,"_height",1e3),n(this,"_extrudedHeight",0),n(this,"_source"),n(this,"_texture"),n(this,"_drawCommand"),n(this,"_geometry"),n(this,"_image"),n(this,"_isDestroyed",!1),n(this,"_worker",new Lt({name:"CreateGeometryWorker"})),n(this,"_colorRamp"),n(this,"_show"),this._extent=u.defaultValue(e.extent,this._extent),this._height=u.defaultValue(e.height,this._height),this._heightScale=u.defaultValue(e.heightScale,this._heightScale),this._extrudedHeight=u.defaultValue(e.extrudedHeight,this._extrudedHeight),this._size=u.defaultValue(e.size,this._size),this._source=u.defaultValue(e.source,this._source),this._interval=u.defaultValue(e.interval,this._interval),this._maxVal=Math.max(...this._source),this._minVal=Math.min(...this._source),this._alpha=u.defaultValue(e.alpha,this._alpha),this._colorRamp=u.defaultValue(e.colorRamp,t.DEFAULT_COLOR_RAMP),this._show=u.defaultValue(e.show,!0);const i=this._interval/2;this._extent=[this._extent[0]-i,this._extent[1]-i,this._extent[2]+i,this._extent[3]+i],this._createGeometry(),this._image=this._createColorRamp()}static getColorRamp(t,e){const i=e;t[t.length-1].value=i;const s=document.createElement("canvas");s.width=100,s.height=1;const r=s.getContext("2d");let a=0;return t.forEach((t=>{r&&(r.fillStyle=t.color);const i=t.value/e*100;r&&r.fillRect(a,0,i,1),a+=i})),s}get show(){return this._show}set show(t){this.setShow(t)}get alpha(){return this._alpha}set alpha(t){this.setAlpha(t)}get colorRamp(){return this._colorRamp}set colorRamp(t){this.setColorRamp(t)}get isDestroyed(){return this._isDestroyed}_createColorRamp(){const e=t.getColorRamp(this._colorRamp,this._maxVal-this._minVal),i=new Image;return i.src=e.toDataURL(),i}_createGeometry(){const{_extent:t,_height:e,_heightScale:i,_extrudedHeight:s}=this,r=new u.RectangleGeometry({ellipsoid:u.Ellipsoid.WGS84,rectangle:u.Rectangle.fromDegrees(...t),height:e*i,extrudedHeight:s*i,vertexFormat:new u.VertexFormat({position:!0,st:!0,normal:!0}),granularity:this._interval/180*Math.PI}),a=u.RectangleGeometry.createGeometry(r);this._worker.postMessage({source:this._source,size:this._size,attributes:null==a?void 0:a.attributes,indices:null==a?void 0:a.indices}),this._worker.onmessage=t=>{const{newPositions:e,newNormals:i,newSts:s,newColors:r,newIndices:n}=t.data,o=Object.assign({},null==a?void 0:a.attributes,{color:new u.GeometryAttribute({componentDatatype:u.ComponentDatatype.FLOAT,componentsPerAttribute:1,values:new Float32Array(r)}),position:new u.GeometryAttribute({componentDatatype:u.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:new Float32Array(e)}),normal:new u.GeometryAttribute({componentDatatype:u.ComponentDatatype.FLOAT,componentsPerAttribute:3,values:new Float32Array(i)}),st:new u.GeometryAttribute({componentDatatype:u.ComponentDatatype.FLOAT,componentsPerAttribute:2,values:new Float32Array(s)})});a&&(a.attributes=o,a.indices=n),this._geometry=a,this._worker.terminate()}}_createTexture(t){return!this._texture&&(this._texture=new u.Texture({context:t,pixelFormat:u.PixelFormat.RGBA,pixelDatatype:u.PixelDatatype.FLOAT,source:this._image})),this._texture}_createCommand(t){if(!u.defined(this._geometry))return;const e=u.GeometryPipeline.createAttributeLocations(this._geometry),i=u.VertexArray.fromGeometry({context:t,geometry:this._geometry,attributes:e}),s=u.RenderState.fromCache({depthTest:{enabled:!0},depthMask:{enabled:!0},blending:u.BlendingState.ALPHA_BLEND}),r=u.ShaderProgram.fromCache({context:t,vertexShaderSource:"in float val;\r\nin vec3 position;\r\nin vec2 st;\r\nin vec3 normal;\n\nout vec3 v_position;\r\nout vec2 v_st;\r\nout float v_val;\r\nout vec3 v_normal;\r\nout vec3 v_positionEC;\n\nvoid main () {\n\n  v_position = position;\r\n  v_st = st;\r\n  v_val = val;\r\n  v_normal = normal;\n\n  v_positionEC = (czm_modelView * vec4(position,1.0)).xyz;\n\n  gl_Position= czm_modelViewProjection * vec4(position,1.0);\n\n}",fragmentShaderSource:"uniform vec2 u_line_width;\r\nuniform vec2 u_line_offset;\n\nuniform sampler2D u_texture_map;\r\nuniform float u_max_val;\r\nuniform float u_min_val;\r\nuniform float u_alpha;\r\nuniform vec3 u_size;\n\nin vec3 v_normal;\r\nin vec2 v_st;\r\nin float v_val;\n\nin vec3 v_positionEC;\n\nvoid main () {\n\n  vec2 st = v_st;\r\n  vec3 positionToEyeEC = -v_positionEC;\n\n  float scaledWidth = fract(u_size.s * st.s);  \n  scaledWidth = abs(scaledWidth - floor(scaledWidth) - u_line_offset.s);\r\n  float scaledHeight = fract(u_size.t * st.t);\r\n  scaledHeight = abs(scaledHeight - floor(scaledHeight) - u_line_offset.t);\r\n  \n  const float fuzz = 0.001;\n\n  float value;\r\n  #ifdef GL_OES_standard_derivatives\r\n    \n    vec2 thickness = (u_line_width * czm_pixelRatio) - 1.0;\r\n    \n    vec2 dx = abs(dFdx(st));\r\n    vec2 dy = abs(dFdy(st));\r\n    vec2 dF = vec2(max(dx.s, dy.s), max(dx.t, dy.t)) * vec2(u_size.s, u_size.t);\r\n    value = min(\r\n      smoothstep(dF.s * thickness.s, dF.s * (fuzz + thickness.s), scaledWidth),\r\n      smoothstep(dF.t * thickness.t, dF.t * (fuzz + thickness.t), scaledHeight)\r\n    );\n\n    \n    \n   \n  #else\n\n    vec2 range = 1.0 - (u_line_width * czm_pixelRatio * 0.05);\r\n    value = min(\r\n      1.0 - smoothstep(range.s, range.s + fuzz, scaledWidth),\r\n      1.0 - smoothstep(range.t, range.t + fuzz, scaledHeight)\r\n    );\r\n  #endif\n\n  \n  \n  float dRim = 1.0 - abs(dot(v_normal, normalize(positionToEyeEC)));\r\n  float sRim = smoothstep(1.0, 1.0, dRim);\r\n  value *= (1.0 - sRim);\n\n  float valInRange = (v_val-u_min_val)/(u_max_val-u_min_val);\r\n  vec4 color = texture(u_texture_map, vec2(valInRange, 0.5));\n\n  \n  color.a = color.a * (1.0 * value * clamp(u_alpha, 0.0, 1.0));\n\n  vec4 newColor = czm_gammaCorrect(color);\n\n  out_FragColor = newColor;\n\n}",attributeLocations:e}),a=this,n={u_texture_map:()=>a._createTexture(t),u_size:()=>new u.Cartesian3(...a._size),u_line_width:()=>new u.Cartesian2(3,3),u_line_offset:()=>new u.Cartesian2(0,0),u_min_val:()=>a._minVal,u_max_val:()=>a._maxVal,u_time:()=>performance.now()/1e3,u_alpha:()=>a._alpha,u_is_grid:()=>!0};this._drawCommand=new u.DrawCommand({pass:u.Pass.OPAQUE,shaderProgram:r,renderState:s,vertexArray:i,uniformMap:n,primitiveType:u.PrimitiveType.TRIANGLES})}setShow(t){this._show=t}setAlpha(t){this._alpha=t}setColorRamp(t){this._colorRamp=t,this._image=this._createColorRamp(),this._drawCommand=void 0,this._texture=void 0}update(t){!this._drawCommand&&this._createCommand(t.context),this._show&&this._drawCommand&&t.commandList.push(this._drawCommand)}destroy(){this._drawCommand=void 0,this._worker.terminate(),this._isDestroyed=!0,super.destroy()}};n(Ot,"DEFAULT_COLOR_RAMP",At);let zt=Ot;const Rt=class t extends K{constructor(e){super(e),n(this,"_type","colorPatternGrid"),n(this,"_primitiveCollection"),n(this,"_size"),n(this,"_levelList"),n(this,"_showLevel"),n(this,"_colorRamp"),n(this,"_rectangle"),n(this,"_alpha"),n(this,"options"),n(this,"ncFileResult"),this.options=e,this._colorRamp=u.defaultValue(this.options.colorRamp,t.DEFAULT_COLOR_RAMP),this.options.interval=u.defaultValue(this.options.interval,.5),this.options.heightScale=u.defaultValue(this.options.heightScale,1),this._alpha=u.defaultValue(this.options.alpha,1)}get isTile(){return!1}get layerSource(){return this._primitiveCollection}get size(){return this._size}get levelList(){return this._levelList}get showLevel(){return this._showLevel}set showLevel(t){this.setShowLevel(t)}get colorRamp(){return this._colorRamp}set colorRamp(t){this.setColorRamp(t)}get alpha(){return this._alpha}set alpha(t){this.setAlpha(t)}get rectangle(){return this._rectangle}async _initHooks(){!this._primitiveCollection&&(this._primitiveCollection=new u.PrimitiveCollection,this._primitiveCollection.show=this.show)}async _addHooks(){var t,e;const i=await this._loadNcFile(this.options.url);if(!i)return;this.ncFileResult=i;const{levArray:s,valArray:r,minx:a,maxx:n,miny:o,maxy:l,nx:h,ny:c,nz:d}=i,p=[a,o,n,l];this._rectangle=u.Rectangle.fromDegrees(p[0],p[1],p[2],p[3]),this._size=[h,c,d],this._levelList=Array.from({length:d}).map(((t,e)=>e));for(let u=0;u<d;u++){const e=h*c,i=r.slice(e*u,e*(u+1)),a=this._dealValues(i,h,c),n=new zt({extent:p,source:a,size:[h,c,d],height:s[u],show:this.options.show,colorRamp:this.options.colorRamp,heightScale:this.options.heightScale,interval:this.options.interval});null==(t=this._primitiveCollection)||t.add(n)}null==(e=this._earth)||e.viewer.scene.primitives.add(this._primitiveCollection),this.setShowLevel(this.options.showLevel)}_removeHooks(){var t;null==(t=this._earth)||t.viewer.scene.primitives.remove(this._primitiveCollection)}_destroyHooks(){var t;null==(t=this._primitiveCollection)||t.removeAll()}_showHooks(t){}_toJsonHooks(t){}_arrayToMap(t){return t.reduce(((t,e)=>(t[e.name]=e,t)),{})}_dealValues(t,e,i){const s=[];for(let r=i-1;r>=0;r--){const i=t.slice(r*e,(r+1)*e);s.push(...i)}return new Float32Array(s)}async _loadNcFile(t){var e;return await(null==(e=u.Resource.fetchArrayBuffer({url:t}))?void 0:e.then((e=>rn("THROW",'_loadNcFile("'+t+'")加载nc数据失败，请按照规范输入nc数据文件地址',(()=>{const t=new Tt(e),i=this._arrayToMap(t.dimensions),s=new Float32Array(t.getDataVariable("lon").flat()),r=new Float32Array(t.getDataVariable("lat").flat());return{lonArray:s,latArray:r,levArray:new Float32Array(t.getDataVariable("level").flat()),valArray:new Float32Array(t.getDataVariable("value").flat()),minx:Math.min(...s),maxx:Math.max(...s),miny:Math.min(...r),maxy:Math.max(...r),nx:i.lon.size,ny:i.lat.size,nz:i.level.size}})))))}getRectangle(t){const e=this._rectangle??u.Rectangle.MAX_VALUE;return!0===t?_a(e):e}setShowLevel(t){var e;if(this._showLevel=t,this._primitiveCollection)if(t){for(let t=0;t<this._primitiveCollection.length;t++){const e=this._primitiveCollection.get(t);e&&(e.show=!1)}null==(e=this._showLevel)||e.forEach((t=>{const e=this._primitiveCollection.get(t);e&&(e.show=!0)}))}else for(let i=0;i<this._primitiveCollection.length;i++){const t=this._primitiveCollection.get(i);t&&(t.show=!0)}}setColorRamp(t){if(this._colorRamp=t,this._primitiveCollection)for(let e=0;e<this._primitiveCollection.length;e++){this._primitiveCollection.get(e).setColorRamp(t)}}setAlpha(t){if(this._alpha=t,this._primitiveCollection)for(let e=0;e<this._primitiveCollection.length;e++){this._primitiveCollection.get(e).setAlpha(t)}}};n(Rt,"DEFAULT_COLOR_RAMP",At);let Dt=Rt;class Nt extends u.WebMercatorTilingScheme{constructor(t){super(t);const e=t.mapChinaCRS,i=t.chinaCRS,s=ga(e,i),r=ga(i,e);if(s){const t=new u.WebMercatorProjection;this._projection.project=function(e,i){return i=s([u.Math.toDegrees(e.longitude),u.Math.toDegrees(e.latitude)]),i=t.project(new u.Cartographic(u.Math.toRadians(i[0]),u.Math.toRadians(i[1]))),new u.Cartesian2(i.x,i.y)},this._projection.unproject=function(e,i){const s=t.unproject(e);return i=r([u.Math.toDegrees(s.longitude),u.Math.toDegrees(s.latitude)]),new u.Cartographic(u.Math.toRadians(i[0]),u.Math.toRadians(i[1]))}}}}function Gt(t){const e=ie[t.type];if(e){return new e(t)}an("NOT_THROW",["createLayer: 无法获得"+t.type+"类型的图层，请检查type参数是否正确",t])}function Vt(t){const e={};for(const i in t){let s=t[i];if(null!=s)switch(i){case"crs":s=(""+s).toUpperCase(),s==z.EPSG4326||"4326"==s||"EPSG4326"==s?(e.crs=z.EPSG4326,e.tilingScheme=new u.GeographicTilingScheme({numberOfLevelZeroTilesX:t.numberOfLevelZeroTilesX||2,numberOfLevelZeroTilesY:t.numberOfLevelZeroTilesY||1})):s==z.EPSG4490||"4490"==s||"EPSG4490"==s?(e.crs=z.EPSG4490,e.tilingScheme=new u.GeographicTilingScheme({numberOfLevelZeroTilesX:t.numberOfLevelZeroTilesX||2,numberOfLevelZeroTilesY:t.numberOfLevelZeroTilesY||1})):(e.crs=z.EPSG3857,e.tilingScheme=new u.WebMercatorTilingScheme({numberOfLevelZeroTilesX:t.numberOfLevelZeroTilesX||1,numberOfLevelZeroTilesY:t.numberOfLevelZeroTilesY||1}));break;case"chinaCRS":t.mapChinaCRS!=t.chinaCRS&&(e.tilingScheme=new Nt({mapChinaCRS:t.mapChinaCRS||O.WGS84,chinaCRS:t.chinaCRS,numberOfLevelZeroTilesX:t.numberOfLevelZeroTilesX||1,numberOfLevelZeroTilesY:t.numberOfLevelZeroTilesY||1}));break;case"rectangle":u.defined(s)&&u.defined(s.xmin)&&u.defined(s.xmax)&&u.defined(s.ymin)&&u.defined(s.ymax)?e.rectangle=u.Rectangle.fromDegrees(s.xmin,s.ymin,s.xmax,s.ymax):e.rectangle=s;break;case"bbox":e.rectangle=u.Rectangle.fromDegrees(s[0],s[1],s[2],s[3]);break;default:e[i]=s}}return e.crs=u.defaultValue(e.crs,z.EPSG3857),e.crs==z.EPSG4490&&e.url&&(e.url=e.url.replace(new RegExp("\\{z\\}","g"),"{z4490}"),e.url=e.url.replace(new RegExp("\\{arc_z\\}","g"),"{arc_z4490}"),e.url=e.url.replace(new RegExp("\\{arc_Z\\}","g"),"{arc_Z4490}")),t.tms&&(e.url=e.url.replace(new RegExp("\\{y\\}","g"),"{reverseY}")),e}const jt=Object.freeze(Object.defineProperty({__proto__:null,converTileLayerOptions:Vt,createLayer:Gt},Symbol.toStringTag,{value:"Module"}));class Ft extends K{constructor(t={}){super(t),n(this,"_type","group"),n(this,"_arrLayer",[]),n(this,"options"),this.options=t,this._arrLayer=[]}get isTile(){return!1}get layerSource(){return this._arrLayer}get zIndex(){return this.options.zIndex??-1}set zIndex(t){this.setZIndex(t)}get length(){var t,e,i;return u.defined(null==(t=this.options)?void 0:t.layers)&&(null==(i=null==(e=this.options)?void 0:e.layers)?void 0:i.length)>0?this.options.layers.length:this._arrLayer.length}get hasChildLayer(){return this.length>0}get hasEmptyGroup(){return 0==this.length}async _initHooks(){const t=this.options.layers;if(t&&t.length>0)for(let e=0;e<t.length;e++){const i=Gt({...t[e],isInternal:this.options.isInternal,eventParent:this});i&&this.addLayer(i)}}async _addHooks(){this.eachLayer((t=>{t.options.eventParent=this,this._earth&&t._onAdd(this._earth)}),this)}_removeHooks(){this.eachLayer((t=>{t._onRemove()}),this)}_destroyHooks(){this.eachLayer((t=>{t.destroy()}),this)}_showHooks(t){this.eachLayer((e=>{e.show=t}),this)}_toJsonHooks(t){}setZIndex(t){this.options.zIndex=t,this.eachLayer((e=>{var i;null==(i=e.setZIndex)||i.call(e,t)}),this)}getRectangle(t){let e;return this.getChildLayers().forEach((t=>{if(!t.getRectangle)return;const i=t.getRectangle();u.defined(i)&&(e=e?u.Rectangle.union(i,e):i)}),this),t?_a(e):e}addLayer(t){var e;t.parent=this,t.options.pid=this.id,t.options.eventParent=this,this._arrLayer.push(t),this.state==N.ADDED&&t.state!=N.ADDED?null==(e=this._earth)||e.addLayer(t):(this._earth&&t.removeEventParent(this._earth),t.addEventParent(this))}removeLayer(t){t.parent=void 0,t.options.eventParent=this,t.removeEventParent(this);for(let e=0;e<this._arrLayer.length;e++)if(this._arrLayer[e]==t)return this._arrLayer.splice(e,1),!0;this._earth&&t.state==N.ADDED&&this._earth.removeLayer(t)}eachLayer(t,e){this._arrLayer&&this._arrLayer.forEach((i=>{t.call(e,i)}))}getChildLayers(){var t;const e=this._arrLayer||[];return null==(t=this._earth)||t.eachLayer((t=>{t.pid===this.id&&(this._arrLayer.includes(t)||e.push(t))}),this),e}getLayer(t){const e=this._arrLayer;if(this._arrLayer&&0!=this._arrLayer.length)for(let i=0,s=e.length;i<s;i++){const s=e[i];if(s.uuid==t||s.id==t||s.name==t)return s}}hasLayer(t,e){for(let i=0;i<this._arrLayer.length;i++){const s=this._arrLayer[i];if((!e||s!=e)&&(s.name==t||s.id==t))return!0}return!1}}n(Ft,"EventType",{...K.EventType});const Wt=class t extends K{constructor(t){super(t),n(this,"_type","terrain"),n(this,"options"),n(this,"terrain"),this.options=t}static async createTerrainProvider(e){let i;if((e=e||{terrainType:re.ELLIPSOID}).terrainType=e.terrainType||re.ELLIPSOID,e.requestVertexNormals=u.defaultValue(e.requestVertexNormals,!0),e.terrainType==re.ION)!M(e.source)&&(e.source=1),i=await u.CesiumTerrainProvider.fromIonAssetId(e.source,e);else if(i=t.Ellipsoid,e.source&&!M(e.source))switch(e.terrainType){case re.XYZ:i=await u.CesiumTerrainProvider.fromUrl(e.source,e);break;case re.ARCGIS:i=await u.ArcGISTiledElevationTerrainProvider.fromUrl(e.source,e);break;case re.VR:i=await u.VRTheWorldTerrainProvider.fromUrl(e.source,e);break;case re.ELLIPSOID:i=t.Ellipsoid;break;default:i=t.Ellipsoid,an("NOT_THROW","createTerrainProvider: 请输入有效的terrainType地形类型")}else i=t.Ellipsoid,an("NOT_THROW","createTerrainProvider: 请输入有效的source服务");return i}get isTile(){return!1}get layerSource(){var t;return null==(t=this.terrain)?void 0:t.provider}_createTerrainProvider(e){return t.createTerrainProvider(e)}async _initHooks(){const t=this._createTerrainProvider(this.options);this.terrain=new u.Terrain(t),this.terrain._pie3d_layerId=this.uuid}async _addHooks(){this._earth&&this.terrain&&this._earth.viewer.scene.setTerrain(this.terrain),this.emit(D.load,{terrain:this.terrain},!0)}_removeHooks(){var e;this._earth&&(null==(e=this.terrain)?void 0:e.provider)&&(this._earth.viewer.terrainProvider=t.Ellipsoid)}_destroyHooks(){this.terrain=void 0}_showHooks(t){t?this._addHooks():this._removeHooks()}_toJsonHooks(t){}getRectangle(t){}};n(Wt,"EventType",{...K.EventType,...f(D,["load"])}),n(Wt,"Ellipsoid",new u.EllipsoidTerrainProvider({ellipsoid:u.Ellipsoid.WGS84}));let qt=Wt;class Bt extends K{constructor(t={}){super(t),n(this,"_opacity"),n(this,"_proxy"),n(this,"_rectangle"),n(this,"_imageryLayer"),n(this,"options"),this.options=t,this._opacity=u.defaultValue(t.opacity,1),u.defined(t.alpha)&&(this._opacity=t.alpha),this.options.proxy&&(C(this.options.proxy)?this._proxy=new u.DefaultProxy(this.options.proxy):this._proxy=this.options.proxy)}get isTile(){return!0}get layerSource(){return this._imageryLayer}get zIndex(){return this.options.zIndex??-1}set zIndex(t){this.setZIndex(t)}get imageryProvider(){var t;return null==(t=this._imageryLayer)?void 0:t.imageryProvider}get opacity(){return this._opacity}set opacity(t){this.setOpacity(t)}get alpha(){return this.opacity}set alpha(t){this.setAlpha(t)}get brightness(){var t;return this.options.brightness||(null==(t=this._imageryLayer)?void 0:t.brightness)}set brightness(t){this.setBrightness(t)}get contrast(){var t;return this.options.contrast||(null==(t=this._imageryLayer)?void 0:t.contrast)||1}set contrast(t){this.setContrast(t)}get hue(){var t;return this.options.hue||(null==(t=this._imageryLayer)?void 0:t.hue)||0}set hue(t){this.setHue(t)}get saturation(){var t;return this.options.saturation||(null==(t=this._imageryLayer)?void 0:t.saturation)||1}set saturation(t){this.setSaturation(t)}get gamma(){var t;return this.options.gamma||(null==(t=this._imageryLayer)?void 0:t.gamma)||1}set gamma(t){this.setGamma(t)}get rectangle(){return this.getRectangle()}set rectangle(t){this.setRectangle(t)}async _initHooks(){const t=this._createImageryProvider({...this.options,rectangle:this.rectangle});if(!u.defined(t))return;const e=this.options,i={show:this.show,alpha:this.opacity,...e,rectangle:this.rectangle};this._imageryLayer=new u.ImageryLayer(t,i),this._imageryLayer._pie3d_layerId=this.uuid,this._imageryLayer._pie3d_config=this.options}async _addHooks(){var t;!this._imageryLayer&&this._initHooks(),null==(t=this._earth)||t.imageryLayers.add(this._imageryLayer),this.options.zIndex&&(this.zIndex=this.options.zIndex),this.emit(D.load,this._imageryLayer,!0)}_removeHooks(){var t;this._imageryLayer&&(null==(t=this._earth)||t.imageryLayers.remove(this._imageryLayer,!1))}_destroyHooks(){var t;null==(t=this._imageryLayer)||t.destroy(),this._imageryLayer=void 0}_showHooks(t){}_toJsonHooks(t){}setZIndex(t){var e,i,s,r,a;if(this.options.zIndex=t,null==this._imageryLayer||null==t)return;null==(s=null==(i=null==(e=this._earth)?void 0:e.viewer)?void 0:i.imageryLayers)||s.raiseToTop(this._imageryLayer);const n=null==(r=this._earth)?void 0:r.imageryLayersArr;if(n)for(let o=n.length-1;o>=0;o--){const e=n[o];if(e==this._imageryLayer)continue;const i=e._pie3d_config;i&&i.zIndex&&t<i.zIndex&&(null==(a=this._earth)||a.imageryLayers.lower(this._imageryLayer))}}setOpacity(t){this._opacity=t,this._imageryLayer&&(this._imageryLayer.alpha=t)}setAlpha(t){this.opacity=t}setBrightness(t){this.options.brightness=t,null!=this._imageryLayer&&(this._imageryLayer.brightness=t)}setContrast(t){this.options.contrast=t,null!=this._imageryLayer&&(this._imageryLayer.contrast=t)}setHue(t){this.options.hue=t,null!=this._imageryLayer&&(this._imageryLayer.hue=t)}setSaturation(t){this.options.saturation=t,null!=this._imageryLayer&&(this._imageryLayer.saturation=t)}setGamma(t){this.options.gamma=t,null!=this._imageryLayer&&(this._imageryLayer.gamma=t)}setRectangle(t){var e,i;this._rectangle=t||(null==(e=this._imageryLayer)?void 0:e.getImageryRectangle())||u.Rectangle.MAX_VALUE,this.options.rectangle=this._rectangle,this.options.extent=_a(this._rectangle),this.options.bbox=[this.options.extent.xmin,this.options.extent.ymin,this.options.extent.xmax,this.options.extent.ymax],(null==(i=this._imageryLayer)?void 0:i.imageryProvider.rectangle)&&(this._imageryLayer.imageryProvider._rectangle=this._rectangle)}getRectangle(t){var e,i,s,r,a,n,o,l;const h=(null==(e=this.options.bbox)?void 0:e[0])??(null==(i=this.options.extent)?void 0:i.xmin)??-180,c=(null==(s=this.options.bbox)?void 0:s[1])??(null==(r=this.options.extent)?void 0:r.ymin)??-90,d=(null==(a=this.options.bbox)?void 0:a[2])??(null==(n=this.options.extent)?void 0:n.xmax)??180,p=(null==(o=this.options.bbox)?void 0:o[3])??(null==(l=this.options.extent)?void 0:l.ymax)??90,m=this._rectangle??u.Rectangle.fromDegrees(h,c,d,p);return!0===t?_a(m):m}}n(Bt,"EventType",{...K.EventType,...f(D,["load","click"])});const Ht=class t extends Bt{constructor(t){super(t),n(this,"options"),n(this,"_type","image"),this.options=t}static createImageryProvider(t){return!(t=Vt(t)).tileWidth&&(t.tileWidth=256),!t.tileHeight&&(t.tileHeight=256),new u.SingleTileImageryProvider(t)}_createImageryProvider(e){return t.createImageryProvider(e)}};n(Ht,"EventType",{...Bt.EventType});let Ut=Ht;const Kt=class t extends Bt{constructor(t){super(t),n(this,"options"),n(this,"capabilities"),n(this,"_type","wms"),this.options=t}static createImageryProvider(t){return t=Vt(t),new u.WebMapServiceImageryProvider(t)}_createImageryProvider(e){return t.createImageryProvider(e)}async _addHooks(){u.defaultValue(this.options.getCapabilities,!0)?(await this.getMetadata(),await super._addHooks()):await super._addHooks()}_initByMetaData(t){let e=this.options.layers;e.includes(":")&&(e=e.split(":")[1]);const i=this._readChildNode(t,"Layer"),s=null==i?void 0:i.getElementsByTagName("Layer");if(null==s?void 0:s.length)for(let r=0,a=s.length;r<a;r++){const t=s[r];if(this._readChildNodeVal(t,"Name")==e){const e=this._readChildNodeVal(t,"CRS");!this.options.crs&&e&&(this.options.crs=e);const i=this._readChildNode(t,"BoundingBox");if(!this.options.rectangle&&i){const t={xmin:Number(i.getAttribute("minx")),ymin:Number(i.getAttribute("miny")),xmax:Number(i.getAttribute("maxx")),ymax:Number(i.getAttribute("maxy"))};this.options.extent=t,this._rectangle=u.Rectangle.fromDegrees(t.xmin,t.ymin,t.xmax,t.ymax)}break}}}_readChildNode(t,e){if(!t||!e)return null;const i=t.getElementsByTagName(e);return i.length>0?i[0]:null}_readChildNodeVal(t,e){if(!t||!e)return null;const i=this._readChildNode(t,e);return(null==i?void 0:i.innerHTML)?i.innerHTML:(null==i?void 0:i.getInnerHTML)?i.getInnerHTML():null}getMetadata(){return new Promise(((t,e)=>{var i;if(this.capabilities)return void t(this.capabilities);const s=this.options.url;(!s||"string"!=typeof s)&&(an("NOT_THROW","getMetadata: 请在构造参数中输入url"),t(void 0)),null==(i=u.Resource.fetchXML({...this.options,url:s,queryParameters:{service:"WMS",request:"GetCapabilities",version:"1.3.0"},proxy:this._proxy}))||i.then((e=>{if(this.state!=N.DESTROYED){if(e){this.capabilities=e;try{this._initByMetaData(e)}catch(i){an("NOT_THROW","getMetadata: WMS解析GetCapabilities有误",i)}}t(e),this.emit(D.loadConfig,{capabilities:e},!0)}})).catch((e=>{an("NOT_THROW","getMetadata: WMS请求出错",e),t(void 0)}))}))}};n(Kt,"EventType",{...Bt.EventType,...f(D,["loadConfig"])});let Zt=Kt;const Xt=class t extends Bt{constructor(t){super(t),n(this,"options"),n(this,"capabilities"),n(this,"_type","wmts"),this.options=t}static createImageryProvider(t){return(t=Vt(t)).crs==z.EPSG4490&&(t.tileMatrixLabels=[...Array.from({length:20}).keys()].map((t=>(t+1).toString()))),new u.WebMapTileServiceImageryProvider(t)}_createImageryProvider(e){return t.createImageryProvider(e)}async _addHooks(){u.defaultValue(this.options.getCapabilities,!0)?(await this.getMetadata(),await super._addHooks()):await super._addHooks()}_initByMetaData(t){const e=this._readChildNode(t,"Contents"),i=null==e?void 0:e.getElementsByTagName("Layer");if(null==i?void 0:i.length)for(let s=0,r=i.length;s<r;s++){const t=i[s],e=this._readChildNodeVal(t,"ows:Identifier");if(e==this.options.layer||this.options.layer.includes(e)){const e=this._readChildNode(t,"ows:WGS84BoundingBox");if(!this.options.rectangle&&e){let t=this._readChildNodeVal(e,"ows:LowerCorner"),i=this._readChildNodeVal(e,"ows:UpperCorner");if(t&&i){t=t.split(" "),i=i.split(" ");const e={xmin:Number(t[0]),ymin:Number(t[1]),xmax:Number(i[0]),ymax:Number(i[1])};this.options.extent=e,this._rectangle=u.Rectangle.fromDegrees(e.xmin,e.ymin,e.xmax,e.ymax)}}!u.defined(this.options.style)&&(this.options.style=this._readChildNodeVal(this._readChildNode(t,"Style"),"ows:Identifier"));const i=t.getElementsByTagName("TileMatrixSetLink");for(let t=0,s=i.length;t<s;t++){const e=i[t],s=this._readChildNodeVal(e,"TileMatrixSet");if(!u.defined(this.options.tileMatrixSetID)&&(this.options.tileMatrixSetID=s),s==this.options.tileMatrixSetID){if(!this.options.tileMatrixLabels){const t=this._readChildNode(e,"TileMatrixSetLimits"),i=null==t?void 0:t.getElementsByTagName("TileMatrixLimits"),s=[];if(null==i?void 0:i.length)for(let e=0,r=i.length;e<r;e++){const t=this._readChildNodeVal(i[e],"TileMatrix");s.push(t)}this.options.tileMatrixLabels=s}break}}break}}}_readChildNode(t,e){if(!t||!e)return;const i=t.getElementsByTagName(e);return i.length>0?i[0]:void 0}_readChildNodeVal(t,e){if(!t||!e)return;const i=this._readChildNode(t,e);return(null==i?void 0:i.innerHTML)?i.innerHTML:(null==i?void 0:i.getInnerHTML)?i.getInnerHTML():void 0}getMetadata(){return new Promise(((t,e)=>{var i;if(this.capabilities)return void t(this.capabilities);const s=this.options.url;(!s||"string"!=typeof s)&&(an("NOT_THROW","getMetadata: 请在构造参数中输入url"),t(void 0)),null==(i=u.Resource.fetchXML({...this.options,url:s,queryParameters:{service:"WMTS",request:"GetCapabilities",version:"1.0.0"},proxy:this._proxy}))||i.then((e=>{if(this.state!=N.DESTROYED){if(e){this.capabilities=e;try{this._initByMetaData(e)}catch(i){an("NOT_THROW","getMetadata: WMTS解析GetCapabilities有误",i)}}t(e),this.emit(D.loadConfig,{capabilities:e},!0)}})).catch((e=>{an("NOT_THROW","getMetadata: WMTS请求出错",e),t(void 0)}))}))}};n(Xt,"EventType",{...Bt.EventType,...f(D,["loadConfig"])});let Jt=Xt;const Yt=class t extends Bt{constructor(t){super(t),n(this,"options"),n(this,"_type","xyz"),this.options=t}static createImageryProvider(t){return(t=Vt(t)).customTags=t.customTags||{},t.customTags.host=function(t,e,i,s){return location.host},t.customTags.hostname=function(t,e,i,s){return location.hostname},t.customTags.z4490=function(t,e,i,s){return s+1},new u.UrlTemplateImageryProvider(t)}_createImageryProvider(e){return t.createImageryProvider(e)}};n(Yt,"EventType",{...Bt.EventType});let Qt=Yt;const $t={id:"default",type:"edge",selectedColor:u.Color.CYAN,length:.01};class te{constructor(t){n(this,"_viewer"),n(this,"_tileset"),n(this,"edgeCache"),n(this,"selected"),n(this,"highlightSchemaCache"),this._viewer=t.viewer,this._tileset=t.tileset,this.highlightSchemaCache={},this.edgeCache={},this.selected={};const e=t.schema??{};t.mergeSchema&&Reflect.ownKeys($t).forEach((i=>{var s;e[i]=(null==(s=t.schema)?void 0:s[i])??$t[i]})),this.addHighlightSchema(e)}addHighlightSchema(t){this.highlightSchemaCache[t.id]=t,this.selected[t.id]=[];const e=u.PostProcessStageLibrary.createEdgeDetectionStage();e.uniforms.color=Ca(t.selectedColor,$t.selectedColor),e.uniforms.length=M(t.length)?t.length:$t.length,e.selected=[],this._viewer.scene.postProcessStages.add(u.PostProcessStageLibrary.createSilhouetteStage([e])),this.edgeCache[t.id]=e}updateHighlightSchema(t,e=!0){if(this.highlightSchemaCache[t.id]){e&&Reflect.ownKeys(this.highlightSchemaCache[t.id]).forEach((e=>{"id"!=e&&(t[e]=t[e]??this.highlightSchemaCache[t.id][e])})),this.highlightSchemaCache[t.id]=t;const i=this.selected[t.id]??[];i.forEach((e=>{this.closeHighlight(e,t.id)})),this._viewer.scene.postProcessStages.remove(this.edgeCache[t.id]),this.edgeCache[t.id].destroy();const s=u.PostProcessStageLibrary.createEdgeDetectionStage();s.uniforms.color=Ca(t.selectedColor,$t.selectedColor),s.uniforms.length=M(t.length)?t.length:$t.length,s.selected=[],this._viewer.scene.postProcessStages.add(u.PostProcessStageLibrary.createSilhouetteStage([s])),i.forEach((e=>{this.openHighlight(e,t.id)})),this.edgeCache[t.id]=s}}openHighlight(t,e=$t.id,i){i&&this.clearHighlight(e),this.selected[e].push(t),"edge"==this.highlightSchemaCache[e].type?this.edgeCache[e].selected=[...this.selected[e]]:t.color=Ca(this.highlightSchemaCache[e].selectedColor)}closeHighlight(t,e=$t.id){const i=this.selected[e].findIndex((e=>t.content.url+"__batchId__"+t.featureId==e.content.url+"__batchId__"+e.featureId));i>-1&&(this.selected[e].splice(i,1),"edge"==this.highlightSchemaCache[e].type?this.edgeCache[e].selected=[...this.selected[e]]:t.color=u.Color.WHITE)}clearHighlight(t=$t.id){this.selected[t].forEach((e=>{this.closeHighlight(e,t)}))}clearAllHighlight(){for(const t in this.highlightSchemaCache)this.clearHighlight(t)}removeHighlightSchema(t){this.clearHighlight(t),this._viewer.scene.postProcessStages.remove(this.edgeCache[t]),this.edgeCache[t].destroy(),Reflect.deleteProperty(this.edgeCache,t),Reflect.deleteProperty(this.highlightSchemaCache,t),Reflect.deleteProperty(this.selected,t)}destroy(){for(const t in this.highlightSchemaCache)this.removeHighlightSchema(t);for(const t in this)delete this[t]}}class ee extends K{constructor(t){super(t),n(this,"_type","tileset"),n(this,"_tileset"),n(this,"_originRotation",{x:0,y:0,z:0}),n(this,"_originCenterPoint",new A),n(this,"_originCenterPosition",new u.Cartesian3),n(this,"_originMatrix"),n(this,"_center",new A),n(this,"_opacity"),n(this,"_styleCallback"),n(this,"_isBindTileVisible",!1),n(this,"_primaryKey","id"),n(this,"_propertiesCache",{}),n(this,"_highlightAll",!1),n(this,"_styleCache"),n(this,"options"),n(this,"highlight"),this.options=t,this._opacity=u.defaultValue(t.opacity,1)}get isTile(){return!1}get layerSource(){return this._tileset}get defaultTilesetOptimizeOptions(){return{maximumScreenSpaceError:64,cacheBytes:2147483648,maximumCacheOverflowBytes:1073741824,cullRequestsWhileMovingMultiplier:100,skipLevelOfDetail:!0,immediatelyLoadDesiredLevelOfDetail:!0,progressiveResolutionHeightFraction:.1}}get tileset(){return this._tileset}get hasTransform(){var t,e;return(null==(t=this._tileset)?void 0:t.root)&&(null==(e=this._tileset.root)?void 0:e.transform)}get boundingSphere(){var t;return null==(t=this._tileset)?void 0:t.boundingSphere}get asset(){var t;return null==(t=this._tileset)?void 0:t.asset}get properties(){var t;return null==(t=this._tileset)?void 0:t.properties}get totalMemoryUsageInBytes(){var t;return null==(t=this._tileset)?void 0:t.totalMemoryUsageInBytes}get originCenterPoint(){return this._originCenterPoint}get originCenterPosition(){return this._originCenterPosition}get position(){return this._center.toCartesian()}get center(){return this._center}get height(){return this._center?this._center.alt:0}set height(t){this.setHeight(t)}get rotation(){return this.options.rotation?this.options.rotation:this._originRotation}set rotation(t){this.setRotation(t)}get rotation_x(){return this.options.rotation&&u.defined(this.options.rotation.x)?this.options.rotation.x:this._originRotation.x}set rotation_x(t){this.setRotationX(t)}get rotation_y(){return this.options.rotation&&u.defined(this.options.rotation.y)?this.options.rotation.y:this._originRotation.y}set rotation_y(t){this.setRotationY(t)}get rotation_z(){return this.options.rotation&&u.defined(this.options.rotation.z)?this.options.rotation.z:this._originRotation.z}set rotation_z(t){this.setRrotationZ(t)}get axis(){return this.options.axis}set axis(t){this.setAxis(t)}get scale(){return this.options.scale||1}set scale(t){this.setScale(t)}get opacity(){return this._opacity}set opacity(t){this.setOpacity(t)}get style(){return this.options.style}set style(t){this.setStyle(t)}get customShader(){return this.options.customShader}set customShader(t){this.setCustomShader(t)}set center(t){this.setCenter(t)}get allowDrillPick(){return this.options.allowDrillPick}set allowDrillPick(t){this.options.allowDrillPick=t}async _initHooks(){}async _addHooks(){rn("THROW","三维模型加载出错，请检查source等构造参数",(async()=>{const t=await this._createCesium3DTileset();if(!t)throw new Error("三维模型加载出错，请检查source等构造参数");this._tileset=t,this._tileset.name=this.name,this._tileset._pie3d_layerId=this.uuid,this._earth.viewer.scene.primitives.add(this._tileset),this._tileset.initialTilesLoaded.addEventListener((t=>{this.emit(D.initialTilesLoaded,t)})),this._tileset.allTilesLoaded.addEventListener((t=>{this.emit(D.allTilesLoaded,t)})),this._tileset.show=this.show,this._tileset.colorBlendMode=u.Cesium3DTileColorBlendMode.REPLACE,this._init()}))}_removeHooks(){this._tileset&&(this._destroyHighlight(),this._earth.viewer.scene.primitives.remove(this._tileset))}_destroyHooks(){var t;null==(t=this._tileset)||t.destroy(),this._tileset=void 0}_showHooks(t){}_toJsonHooks(t){}_createCesium3DTileset(){if("number"==typeof this.options.source){const t=this.options.source;return u.Cesium3DTileset.fromIonAssetId(t,this.options)}{const t=this.options.source;return u.Cesium3DTileset.fromUrl(t,this.options)}}_bindTileVisibleEvent(){var t;!this._isBindTileVisible&&(null==(t=this._tileset)||t.tileVisible.addEventListener(this._updateTile,this),this._isBindTileVisible=!0)}_updateTile(t){const e=t.content;for(let i=0;i<e.featuresLength;i++){const t=e.getFeature(i);if(this._propertiesCache){const e=t.getProperty(this._primaryKey);e&&this.setFeatureProperties(t,this._propertiesCache[e])}if(this._styleCallback){const e=this.getFeatureProperties(t),i=this._styleCallback({feature:t,properties:e});i&&(t.color=Ca(i))}}this.emit(D.update)}_mergePostion(t){t&&(!this._center&&(this._center=new A),u.defined(t.lat)&&(this._center.lat=t.lat),u.defined(t.lng)&&(this._center.lng=t.lng),u.defined(t.alt)&&(this._center.alt=t.alt))}_initHighlight(){var t;if(this.highlight)return;this.highlight=new te({viewer:this._earth.viewer,tileset:this._tileset,schema:{...this.options.highlight,id:this.id},mergeSchema:!0});const e=(null==(t=this.options.highlight)?void 0:t.trigger)??"click";this.on(D.click,(t=>{var i,s,r,a,n,o,l,h;if("click"==e){if((null==(i=this.options.highlight)?void 0:i.filter)&&!(null==(r=null==(s=this.options.highlight)?void 0:s.filter)?void 0:r.call(s,t.data)))return;if(t.sourceTarget instanceof u.Cesium3DTileFeature){if(this._tileset&&(null==(a=this.options.highlight)?void 0:a.all)){const t=Ca(null==(n=this.options.highlight)?void 0:n.selectedColor).toCssColorString();return this._tileset.style=new u.Cesium3DTileStyle({color:{conditions:[["true",t]]}}),void(this._highlightAll=!0)}null==(l=this.highlight)||l.openHighlight(t.sourceTarget,this.id,!(null==(o=this.options.highlight)?void 0:o.multi))}else{if(this._tileset&&this._highlightAll)return this._highlightAll=!1,void(this._tileset.style=this._styleCache);null==(h=this.highlight)||h.clearHighlight(this.id)}}})),this.on(D.mouseOver,(t=>{var i,s,r,a,n,o,l;if("hover"==e){if((null==(i=this.options.highlight)?void 0:i.filter)&&!(null==(r=null==(s=this.options.highlight)?void 0:s.filter)?void 0:r.call(s,t.data)))return;if(t.sourceTarget instanceof u.Cesium3DTileFeature){if(this._tileset&&(null==(a=this.options.highlight)?void 0:a.all)){const t=Ca(null==(n=this.options.highlight)?void 0:n.selectedColor).toCssColorString();return this._tileset.style=new u.Cesium3DTileStyle({color:{conditions:[["true",t]]}}),void(this._highlightAll=!0)}null==(l=this.highlight)||l.openHighlight(t.sourceTarget,this.id,!(null==(o=this.options.highlight)?void 0:o.multi))}}})),this.on(D.mouseOut,(t=>{var i,s;if("hover"==e){if(this._tileset&&this._highlightAll)return this._highlightAll=!1,void(this._tileset.style=this._styleCache);!(null==(i=this.options.highlight)?void 0:i.multi)&&(null==(s=this.highlight)||s.clearHighlight(this.id))}}))}_destroyHighlight(){var t;null==(t=this.highlight)||t.destroy(),this.highlight=void 0}_init(){var t,e,i,s;if(this._originCenterPosition=u.clone(null==(t=this._tileset)?void 0:t.boundingSphere.center),this.hasTransform&&this._tileset){const t=this._tileset.root.transform instanceof u.Matrix4?this._tileset.root.transform:u.Matrix4.fromArray(this._tileset.root.transform);this._originMatrix=u.Matrix4.inverse(t,new u.Matrix4);const e=u.Matrix4.getTranslation(t,new u.Cartesian3);if(u.defined(e)&&u.Cartographic.fromCartesian(e)){this._originCenterPosition=e;const i=u.Matrix4.getMatrix3(t,new u.Matrix3),s=u.Matrix4.getMatrix3(u.Transforms.eastNorthUpToFixedFrame(e),new u.Matrix3),r=u.Matrix3.getColumn(s,0,new u.Cartesian3),a=u.Matrix3.getColumn(s,1,new u.Cartesian3),n=u.Matrix3.getColumn(s,2,new u.Cartesian3);let o=u.Matrix3.getColumn(i,0,new u.Cartesian3);o=u.Cartesian3.cross(o,n,o),o=u.Cartesian3.cross(n,o,o),o=u.Cartesian3.normalize(o,o);let l=u.Cartesian3.angleBetween(r,o);u.Cartesian3.angleBetween(a,o)>.5*Math.PI&&(l=2*Math.PI-l),this._originRotation={x:0,y:0,z:Number(u.Math.toDegrees(l).toFixed(1))}}}if(this._originCenterPoint=A.fromCartesian(this._originCenterPosition),function(t){const e=w(t)?t[0]:t,i=w(t)?t.slice(1):[],s=["[PIE3D Info]: “"+e+"”.",...i];console.log(...s)}(this.name+" 模型中心位置:"+this._originCenterPoint.toString()),u.defined(this.options.style)&&(this.style=this.options.style),this._styleCache=null==(e=this.tileset)?void 0:e.style,1!=this._opacity&&this.setOpacity(this._opacity),this._center=this._originCenterPoint.clone(),this.options.position&&this._mergePostion(this.options.position),this.options.chinaCRS){const t=this._transformCenter(this.center);t&&this._mergePostion(t)}this._hasUpdateMater()&&this.updateMatrix(),this.options.clampToGround&&this.clampToGround(),this.options.flyTo&&(u.defined(null==(i=this.options.homeVision)?void 0:i.pitch)?this.flyTo():this.flyTo({minPitch:-45,maxPitch:45})),!(null==(s=this.options.highlight)?void 0:s.disable)&&this._initHighlight(),this.emit(D.load,{tileset:this._tileset})}_transformCenter(t){const e=this._earth._chinaCRS,i=this.options.chinaCRS;if(e&&i&&e!=i){const s=ga(i,e);if(!s)return;const r=s([t.lng,t.lat]);return{lng:r[0],lat:r[1],alt:t.alt}}return{lng:t.lng,lat:t.lat,alt:t.alt}}_hasUpdateMater(){return!this.center.equals(this._originCenterPoint)||(!!this.options.rotation||(!!(u.defined(this.options.scale)&&this.options.scale>0&&1!=this.options.scale)||!!u.defined(this.options.axis)))}_updateMatrix2(){if(!this._tileset||!this._tileset.root)return;const t=u.Cartographic.fromCartesian(this._tileset.boundingSphere.center),e=u.Cartesian3.fromRadians(t.longitude,t.latitude,0),i=this.position,s=u.Cartesian3.subtract(i,e,new u.Cartesian3),r=u.Matrix4.fromTranslation(s);return this._tileset.modelMatrix=r,r}setOpacity(t){this._opacity=t,this._tileset&&(this._tileset.style=new u.Cesium3DTileStyle({color:"color() * vec4(1.0 ,1.0 ,1.0, "+t+")"}))}setCenter(t){this._center=A.parse(t),this.updateMatrix()}setHeight(t){this._tileset&&(this._center.alt=t,this.updateMatrix())}setRotation(t){this.options.rotation=t,this.updateMatrix()}setRotationX(t){this.options.rotation=this.options.rotation||{x:0,y:0,z:0},this.options.rotation.x=t,this.updateMatrix()}setRotationY(t){this.options.rotation=this.options.rotation||{x:0,y:0,z:0},this.options.rotation.y=t,this.updateMatrix()}setRrotationZ(t){this.options.rotation=this.options.rotation||{x:0,y:0,z:0},this.options.rotation.z=t,this.updateMatrix()}setAxis(t){this.options.axis=t,this.updateMatrix()}setScale(t){this.options.scale=t,this.updateMatrix()}setStyle(t){this.options.style=t,this._styleCallback=void 0,this._tileset&&(t instanceof u.Cesium3DTileStyle?this._tileset.style=t:"function"==typeof t?(this._styleCallback=t,this._bindTileVisibleEvent()):this._tileset.style=new u.Cesium3DTileStyle(t),this._styleCache=this._tileset.style)}setCustomShader(t){this.options.customShader=t,this._tileset&&(this._tileset.customShader=t)}clampToGround(t=1){this._earth.hasTerrain?da(this._earth.viewer,this._originCenterPosition,{async:!0,callback:(e,i)=>{null!=e&&(this.height=e-this._originCenterPoint.alt+t)}}):this.height=-this._originCenterPoint.alt+t}setProperties(t,e="id"){this._primaryKey=e,this._propertiesCache={},t.forEach((t=>{const i=t[e];this._propertiesCache[i]=t})),this._bindTileVisibleEvent()}getFeatureProperties(t){const e={},i=t.getPropertyIds();for(let s=0;s<i.length;s++){const r=i[s];if(!t.hasProperty(r))continue;const a=t.getProperty(r);null!=a&&(e[r]=a)}return e}setFeatureProperties(t,e){if(t&&e)for(const i in e){const s=e[i];t.hasProperty(i)&&t.getProperty(i)===s||t.setProperty(i,s)}}updateMatrix(){if(!this._tileset)return;if(!this.hasTransform)return this._updateMatrix2();let t=u.Transforms.eastNorthUpToFixedFrame(this.position);if(this.options.rotation){const e=u.Matrix3.fromRotationX(u.Math.toRadians(this.rotation_x)),i=u.Matrix3.fromRotationY(u.Math.toRadians(this.rotation_y)),s=u.Matrix3.fromRotationZ(u.Math.toRadians(360-this.rotation_z)),r=u.Matrix4.fromRotationTranslation(e),a=u.Matrix4.fromRotationTranslation(i),n=u.Matrix4.fromRotationTranslation(s);u.Matrix4.multiply(t,r,t),u.Matrix4.multiply(t,a,t),u.Matrix4.multiply(t,n,t)}if(u.defined(this.options.scale)&&this.options.scale>0&&1!=this.options.scale&&u.Matrix4.multiplyByUniformScale(t,this.options.scale,t),u.defined(this.options.axis)){let e;C(this.options.axis)&&(e=u.Axis.fromName(this.options.axis.toUpperCase())),e&&(t=u.Matrix4.multiplyTransformation(t,e,t))}return this._tileset.root.transform=t,t}optimize(t=this.defaultTilesetOptimizeOptions,e=!0){if(e)for(const i in this.defaultTilesetOptimizeOptions)t[i]??(t[i]=this.defaultTilesetOptimizeOptions[i]);if(this._tileset)for(const i in t)this._tileset[i]=t[i]}createCustomShader(t,e){let i;switch(t){case R.DistanceColorChange:const t=e,s=(null==t?void 0:t.changedRgbIndex)??"g",r=(null==t?void 0:t.far)??1e4,a=Ca(null==t?void 0:t.baseColor,u.Color.BLUE);i=new u.CustomShader({uniforms:{u_baseColor:{type:u.UniformType.VEC3,value:a},u_far:{type:u.UniformType.FLOAT,value:r},u_changedR:{type:u.UniformType.BOOL,value:"r"==s},u_changedG:{type:u.UniformType.BOOL,value:"g"==s},u_changedB:{type:u.UniformType.BOOL,value:"b"==s}},lightingModel:u.LightingModel.UNLIT,fragmentShaderText:"\n            void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {\n              // 初始纯蓝色\n              material.diffuse = u_baseColor;\n              // rgb  r:代表red的色值，从fsInput.attributes.positionEC.z（很可能是眼坐标（Eye Coordinates）下的顶点Z位置）中获取一个值，并将其除以1.0e4（即10,000），然后取反，赋值给material.diffuse.g\n              if(u_changedR){\n                material.diffuse.r = -fsInput.attributes.positionEC.z / u_far;\n              }\n              if(u_changedG){\n                material.diffuse.g = -fsInput.attributes.positionEC.z / u_far;\n              }\n              if(u_changedB){\n                material.diffuse.b = -fsInput.attributes.positionEC.z / u_far;\n              }\n            } "});break;case R.DynamicHalo:const n=e;(null==n?void 0:n.onClick)&&this.on(D.click,(t=>{var e;null==(e=null==n?void 0:n.onClick)||e.call(n,this,t)}));const o=Ca(null==n?void 0:n.baseColorBottom,u.Color.BLACK),l=Ca(null==n?void 0:n.baseColorTop,u.Color.INDIGO),h=Ca(null==n?void 0:n.lightColor,u.Color.fromCssColorString("#ff00ff")),c=(null==n?void 0:n.baseHeight)??0,d=(null==n?void 0:n.heightRange)??400,p=(null==n?void 0:n.glowRange)??400,m=(null==n?void 0:n.lightRadius)??1e3,f=A.parse((null==n?void 0:n.lightPosition)??[0,0,0]).toCartesian();i=new u.CustomShader({uniforms:{u_baseColorBottom:{type:u.UniformType.VEC3,value:o},u_baseColorTop:{type:u.UniformType.VEC3,value:l},u_baseHeight:{type:u.UniformType.FLOAT,value:c},u_heightRange:{type:u.UniformType.FLOAT,value:d},u_glowRange:{type:u.UniformType.FLOAT,value:p},u_lightPosition:{type:u.UniformType.VEC3,value:f},u_lightColor:{type:u.UniformType.VEC3,value:h},u_lightRadius:{type:u.UniformType.FLOAT,value:m}},lightingModel:u.LightingModel.UNLIT,mode:u.CustomShaderMode.REPLACE_MATERIAL,fragmentShaderText:"\n            #define sat( a ) clamp( a, 0.0, 1.0 )\n            float getDistanceDecay( float lightDistance, float distance,float decay) {\n              if ( distance > 0.0 && decay > 0.0 ) {\n                  return pow( sat( - lightDistance / distance + 1.0 ), decay );\n              }\n              return 1.0;\n            }\n            vec3 addPointLight(vec3 lightPosition, vec3 lightColor, vec3 positionWC , vec3 normal){\n              float distance = u_lightRadius;\n              float decay = 1.0;\n              float lightDistance = length( lightPosition - positionWC );\n              lightColor *= getDistanceDecay( lightDistance, distance, decay );\n              return lightColor;\n            }\n\n            void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material)\n            {\n              vec3 positionMC = fsInput.attributes.positionMC;\n              vec3 normalEC = fsInput.attributes.normalEC;\n              float jzw_height = positionMC.z - u_baseHeight;\n              vec3 glColor = vec3(0.);\n\n              // 渐变\n              glColor.rgb = mix(u_baseColorBottom, u_baseColorTop,clamp(positionMC.z / u_heightRange, 0.0, 1.0)) ;\n              float diffuseCoefficient = max(0.0, dot(normalEC, vec3(0.5)) * 1.0);\n              glColor.rgb *= min(diffuseCoefficient + 0.1, 1.0);\n\n              // 光圈特效\n              float time = fract(czm_frameNumber / 360.0);\n              time = abs(time - 0.5) * 2.0;\n              float jzw_h = clamp(jzw_height / u_glowRange, 0.0, 1.0);\n              float jzw_diff = step(0.005, abs(jzw_h - time));\n              glColor.rgb += glColor.rgb * (1.0 - jzw_diff);\n\n              // 点光源\n              glColor.rgb += addPointLight(\n                u_lightPosition ,\n                u_lightColor,\n                (czm_model * vec4(positionMC,1.0)).xyz,\n                normalEC);\n\n              material.diffuse = mix(glColor.rgb, material.diffuse, 0.0);\n            } "});break;default:i=void 0}return i}getRectangle(t){if(this.boundingSphere){const e=u.Rectangle.fromBoundingSphere(this.boundingSphere);return t?_a(e):e}}}n(ee,"EventType",{...K.EventType,...f(D,["click","rightClick","mouseOver","mouseOut","initialTilesLoaded","allTilesLoaded","load","update"])});const ie={terrain:qt,wms:Zt,wmts:Jt,image:Ut,xyz:Qt,tileset:ee,group:Ft,colorPatternGrid:Dt,colorPatternGradient:rt},se={Color:u.Material.ColorType,Image:u.Material.ImageType,Grid:u.Material.GridType,Checkerboard:u.Material.CheckerboardType,Stripe:u.Material.StripeType,Image2:"Image2",Water:u.Material.WaterType,PolylineDash:u.Material.PolylineDashType,PolylineOutline:u.Material.PolylineOutlineType,PolylineArrow:u.Material.PolylineArrowType,PolylineGlow:u.Material.PolylineGlowType,LineFlow:"LineFlow",LineFlowColor:"LineFlowColor",ODLine:"ODLine",LineFlicker:"LineFlicker",LineTrail:"LineTrail",WallScroll:"WallScroll",ScanLine:"ScanLine",CircleScan:"CircleScan",CircleWave:"CircleWave",RadarLine:"RadarLine",RadarWave:"RadarWave",Text:"Text",RectSlide:"RectSlide",PolyGradient:"PolyGradient",PolyAsphalt:"PolyAsphalt",PolyBlob:"PolyBlob",PolyFacet:"PolyFacet",PolyGrass:"PolyGrass",PolyWood:"PolyWood",EllipsoidElectric:"EllipsoidElectric",EllipsoidWave:"EllipsoidWave",CylinderWave:"CylinderWave",ColorPatternGradient:"ColorPatternGradient"},re={ELLIPSOID:"ellipsoid",XYZ:"xyz",ION:"ion",VR:"vr",ARCGIS:"arcgis"},ae=Object.freeze(Object.defineProperty({__proto__:null,CRS:z,ChinaCRS:O,ClipType:{Z:1,ZR:2,X:3,XR:4,Y:5,YR:6},CustomShaderType:R,EventType:D,LayerType:ie,LifeCycleState:{INITED:"inited",ADDED:"added",REMOVED:"removed",DESTROYED:"destroyed"},MaterialType:se,MoveType:{ENLARGE:0,NARROW:1,LEFT_ROTATE:2,RIGHT_ROTATE:3,TOP_ROTATE:4,BOTTOM_ROTATE:5},State:N,TerrainType:re},Symbol.toStringTag,{value:"Module"}));class ne{static toCartesians(t,e){if(!Array.isArray(t))return t;const i=[];return t.forEach((t=>{if(t instanceof u.Cartesian3&&!e)return void i.push(t);const s=A.parse(t);s&&s.valid()&&i.push(s.toCartesian())})),i}static toPoints(t){if(!Array.isArray(t))return t;const e=[];return t.forEach((t=>{if(t instanceof A)return void e.push(t);const i=A.parse(t);i&&i.valid()&&e.push(i)})),e}static toArray(t,e){if(!Array.isArray(t))return t;const i=[];return t.forEach((t=>{if(Array.isArray(t))return void i.push(t);const s=A.parse(t);s&&s.valid()&&i.push(s.toArray(e))})),i}}var oe=6378137,le=.0066943799901413165,he=484813681109536e-20,ce=Math.PI/2,ue=1e-10,de=.017453292519943295,pe=57.29577951308232,me=Math.PI/4,fe=2*Math.PI,_e=3.14159265359,ye={greenwich:0,lisbon:-9.131906111111,paris:2.337229166667,bogota:-74.080916666667,madrid:-3.687938888889,rome:12.452333333333,bern:7.439583333333,jakarta:106.807719444444,ferro:-17.666666666667,brussels:4.367975,stockholm:18.058277777778,athens:23.7163375,oslo:10.722916666667};const ge={ft:{to_meter:.3048},"us-ft":{to_meter:1200/3937}};var ve=/[\s_\-\/\(\)]/g;function Me(t,e){if(t[e])return t[e];for(var i,s=Object.keys(t),r=e.toLowerCase().replace(ve,""),a=-1;++a<s.length;)if((i=s[a]).toLowerCase().replace(ve,"")===r)return t[i]}function Ce(t){var e,i,s,r={},a=t.split("+").map((function(t){return t.trim()})).filter((function(t){return t})).reduce((function(t,e){var i=e.split("=");return i.push(!0),t[i[0].toLowerCase()]=i[1],t}),{}),n={proj:"projName",datum:"datumCode",rf:function(t){r.rf=parseFloat(t)},lat_0:function(t){r.lat0=t*de},lat_1:function(t){r.lat1=t*de},lat_2:function(t){r.lat2=t*de},lat_ts:function(t){r.lat_ts=t*de},lon_0:function(t){r.long0=t*de},lon_1:function(t){r.long1=t*de},lon_2:function(t){r.long2=t*de},alpha:function(t){r.alpha=parseFloat(t)*de},gamma:function(t){r.rectified_grid_angle=parseFloat(t)},lonc:function(t){r.longc=t*de},x_0:function(t){r.x0=parseFloat(t)},y_0:function(t){r.y0=parseFloat(t)},k_0:function(t){r.k0=parseFloat(t)},k:function(t){r.k0=parseFloat(t)},a:function(t){r.a=parseFloat(t)},b:function(t){r.b=parseFloat(t)},r:function(t){r.a=r.b=parseFloat(t)},r_a:function(){r.R_A=!0},zone:function(t){r.zone=parseInt(t,10)},south:function(){r.utmSouth=!0},towgs84:function(t){r.datum_params=t.split(",").map((function(t){return parseFloat(t)}))},to_meter:function(t){r.to_meter=parseFloat(t)},units:function(t){r.units=t;var e=Me(ge,t);e&&(r.to_meter=e.to_meter)},from_greenwich:function(t){r.from_greenwich=t*de},pm:function(t){var e=Me(ye,t);r.from_greenwich=(e||parseFloat(t))*de},nadgrids:function(t){"@null"===t?r.datumCode="none":r.nadgrids=t},axis:function(t){var e="ewnsud";3===t.length&&-1!==e.indexOf(t.substr(0,1))&&-1!==e.indexOf(t.substr(1,1))&&-1!==e.indexOf(t.substr(2,1))&&(r.axis=t)},approx:function(){r.approx=!0}};for(e in a)i=a[e],e in n?"function"==typeof(s=n[e])?s(i):r[s]=i:r[e]=i;return"string"==typeof r.datumCode&&"WGS84"!==r.datumCode&&(r.datumCode=r.datumCode.toLowerCase()),r}var xe=/\s/,be=/[A-Za-z]/,we=/[A-Za-z84_]/,Pe=/[,\]]/,Se=/[\d\.E\-\+]/;function Te(t){if("string"!=typeof t)throw new Error("not a string");this.text=t.trim(),this.level=0,this.place=0,this.root=null,this.stack=[],this.currentObject=null,this.state=1}function Ee(t,e,i){Array.isArray(e)&&(i.unshift(e),e=null);var s=e?{}:t,r=i.reduce((function(t,e){return ke(e,t),t}),s);e&&(t[e]=r)}function ke(t,e){if(Array.isArray(t)){var i=t.shift();if("PARAMETER"===i&&(i=t.shift()),1===t.length)return Array.isArray(t[0])?(e[i]={},void ke(t[0],e[i])):void(e[i]=t[0]);if(t.length)if("TOWGS84"!==i){if("AXIS"===i)return!(i in e)&&(e[i]=[]),void e[i].push(t);var s;switch(!Array.isArray(i)&&(e[i]={}),i){case"UNIT":case"PRIMEM":case"VERT_DATUM":return e[i]={name:t[0].toLowerCase(),convert:t[1]},void(3===t.length&&ke(t[2],e[i]));case"SPHEROID":case"ELLIPSOID":return e[i]={name:t[0],a:t[1],rf:t[2]},void(4===t.length&&ke(t[3],e[i]));case"PROJECTEDCRS":case"PROJCRS":case"GEOGCS":case"GEOCCS":case"PROJCS":case"LOCAL_CS":case"GEODCRS":case"GEODETICCRS":case"GEODETICDATUM":case"EDATUM":case"ENGINEERINGDATUM":case"VERT_CS":case"VERTCRS":case"VERTICALCRS":case"COMPD_CS":case"COMPOUNDCRS":case"ENGINEERINGCRS":case"ENGCRS":case"FITTED_CS":case"LOCAL_DATUM":case"DATUM":return t[0]=["name",t[0]],void Ee(e,i,t);default:for(s=-1;++s<t.length;)if(!Array.isArray(t[s]))return ke(t,e[i]);return Ee(e,i,t)}}else e[i]=t;else e[i]=!0}else e[t]=!0}Te.prototype.readCharicter=function(){var t=this.text[this.place++];if(4!==this.state)for(;xe.test(t);){if(this.place>=this.text.length)return;t=this.text[this.place++]}switch(this.state){case 1:return this.neutral(t);case 2:return this.keyword(t);case 4:return this.quoted(t);case 5:return this.afterquote(t);case 3:return this.number(t);case-1:return}},Te.prototype.afterquote=function(t){if('"'===t)return this.word+='"',void(this.state=4);if(Pe.test(t))return this.word=this.word.trim(),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in afterquote yet, index '+this.place)},Te.prototype.afterItem=function(t){return","===t?(null!==this.word&&this.currentObject.push(this.word),this.word=null,void(this.state=1)):"]"===t?(this.level--,null!==this.word&&(this.currentObject.push(this.word),this.word=null),this.state=1,this.currentObject=this.stack.pop(),void(!this.currentObject&&(this.state=-1))):void 0},Te.prototype.number=function(t){if(!Se.test(t)){if(Pe.test(t))return this.word=parseFloat(this.word),void this.afterItem(t);throw new Error("havn't handled \""+t+'" in number yet, index '+this.place)}this.word+=t},Te.prototype.quoted=function(t){'"'!==t?this.word+=t:this.state=5},Te.prototype.keyword=function(t){if(we.test(t))this.word+=t;else{if("["===t){var e=[];return e.push(this.word),this.level++,null===this.root?this.root=e:this.currentObject.push(e),this.stack.push(this.currentObject),this.currentObject=e,void(this.state=1)}if(!Pe.test(t))throw new Error("havn't handled \""+t+'" in keyword yet, index '+this.place);this.afterItem(t)}},Te.prototype.neutral=function(t){if(be.test(t))return this.word=t,void(this.state=2);if('"'===t)return this.word="",void(this.state=4);if(Se.test(t))return this.word=t,void(this.state=3);if(!Pe.test(t))throw new Error("havn't handled \""+t+'" in neutral yet, index '+this.place);this.afterItem(t)},Te.prototype.output=function(){for(;this.place<this.text.length;)this.readCharicter();if(-1===this.state)return this.root;throw new Error('unable to parse string "'+this.text+'". State is '+this.state)};var Ie;function Le(t){return.017453292519943295*t}function Ae(t){var e=new Te(t).output(),i=e.shift(),s=e.shift();e.unshift(["name",s]),e.unshift(["type",i]);var r={};return ke(e,r),function(t){if("GEOGCS"===t.type?t.projName="longlat":"LOCAL_CS"===t.type?(t.projName="identity",t.local=!0):"object"==typeof t.PROJECTION?t.projName=Object.keys(t.PROJECTION)[0]:t.projName=t.PROJECTION,t.AXIS){for(var e="",i=0,s=t.AXIS.length;i<s;++i){var r=[t.AXIS[i][0].toLowerCase(),t.AXIS[i][1].toLowerCase()];-1!==r[0].indexOf("north")||("y"===r[0]||"lat"===r[0])&&"north"===r[1]?e+="n":-1!==r[0].indexOf("south")||("y"===r[0]||"lat"===r[0])&&"south"===r[1]?e+="s":-1!==r[0].indexOf("east")||("x"===r[0]||"lon"===r[0])&&"east"===r[1]?e+="e":(-1!==r[0].indexOf("west")||("x"===r[0]||"lon"===r[0])&&"west"===r[1])&&(e+="w")}2===e.length&&(e+="u"),3===e.length&&(t.axis=e)}t.UNIT&&(t.units=t.UNIT.name.toLowerCase(),"metre"===t.units&&(t.units="meter"),t.UNIT.convert&&("GEOGCS"===t.type?t.DATUM&&t.DATUM.SPHEROID&&(t.to_meter=t.UNIT.convert*t.DATUM.SPHEROID.a):t.to_meter=t.UNIT.convert));var a=t.GEOGCS;function n(e){return e*(t.to_meter||1)}"GEOGCS"===t.type&&(a=t),a&&(a.DATUM?t.datumCode=a.DATUM.name.toLowerCase():t.datumCode=a.name.toLowerCase(),"d_"===t.datumCode.slice(0,2)&&(t.datumCode=t.datumCode.slice(2)),("new_zealand_geodetic_datum_1949"===t.datumCode||"new_zealand_1949"===t.datumCode)&&(t.datumCode="nzgd49"),("wgs_1984"===t.datumCode||"world_geodetic_system_1984"===t.datumCode)&&("Mercator_Auxiliary_Sphere"===t.PROJECTION&&(t.sphere=!0),t.datumCode="wgs84"),"_ferro"===t.datumCode.slice(-6)&&(t.datumCode=t.datumCode.slice(0,-6)),"_jakarta"===t.datumCode.slice(-8)&&(t.datumCode=t.datumCode.slice(0,-8)),~t.datumCode.indexOf("belge")&&(t.datumCode="rnb72"),a.DATUM&&a.DATUM.SPHEROID&&(t.ellps=a.DATUM.SPHEROID.name.replace("_19","").replace(/[Cc]larke\_18/,"clrk"),"international"===t.ellps.toLowerCase().slice(0,13)&&(t.ellps="intl"),t.a=a.DATUM.SPHEROID.a,t.rf=parseFloat(a.DATUM.SPHEROID.rf,10)),a.DATUM&&a.DATUM.TOWGS84&&(t.datum_params=a.DATUM.TOWGS84),~t.datumCode.indexOf("osgb_1936")&&(t.datumCode="osgb36"),~t.datumCode.indexOf("osni_1952")&&(t.datumCode="osni52"),(~t.datumCode.indexOf("tm65")||~t.datumCode.indexOf("geodetic_datum_of_1965"))&&(t.datumCode="ire65"),"ch1903+"===t.datumCode&&(t.datumCode="ch1903"),~t.datumCode.indexOf("israel")&&(t.datumCode="isr93")),t.b&&!isFinite(t.b)&&(t.b=t.a),[["standard_parallel_1","Standard_Parallel_1"],["standard_parallel_1","Latitude of 1st standard parallel"],["standard_parallel_2","Standard_Parallel_2"],["standard_parallel_2","Latitude of 2nd standard parallel"],["false_easting","False_Easting"],["false_easting","False easting"],["false-easting","Easting at false origin"],["false_northing","False_Northing"],["false_northing","False northing"],["false_northing","Northing at false origin"],["central_meridian","Central_Meridian"],["central_meridian","Longitude of natural origin"],["central_meridian","Longitude of false origin"],["latitude_of_origin","Latitude_Of_Origin"],["latitude_of_origin","Central_Parallel"],["latitude_of_origin","Latitude of natural origin"],["latitude_of_origin","Latitude of false origin"],["scale_factor","Scale_Factor"],["k0","scale_factor"],["latitude_of_center","Latitude_Of_Center"],["latitude_of_center","Latitude_of_center"],["lat0","latitude_of_center",Le],["longitude_of_center","Longitude_Of_Center"],["longitude_of_center","Longitude_of_center"],["longc","longitude_of_center",Le],["x0","false_easting",n],["y0","false_northing",n],["long0","central_meridian",Le],["lat0","latitude_of_origin",Le],["lat0","standard_parallel_1",Le],["lat1","standard_parallel_1",Le],["lat2","standard_parallel_2",Le],["azimuth","Azimuth"],["alpha","azimuth",Le],["srsCode","name"]].forEach((function(e){return function(t,e){var i=e[0],s=e[1];!(i in t)&&s in t&&(t[i]=t[s],3===e.length&&(t[i]=e[2](t[i])))}(t,e)})),!t.long0&&t.longc&&("Albers_Conic_Equal_Area"===t.projName||"Lambert_Azimuthal_Equal_Area"===t.projName)&&(t.long0=t.longc),t.lat_ts||!t.lat1||"Stereographic_South_Pole"!==t.projName&&"Polar Stereographic (variant B)"!==t.projName?!t.lat_ts&&t.lat0&&"Polar_Stereographic"===t.projName&&(t.lat_ts=t.lat0,t.lat0=Le(t.lat0>0?90:-90)):(t.lat0=Le(t.lat1>0?90:-90),t.lat_ts=t.lat1)}(r),r}function Oe(t){var e=this;if(2===arguments.length){var i=arguments[1];"string"==typeof i?"+"===i.charAt(0)?Oe[t]=Ce(arguments[1]):Oe[t]=Ae(arguments[1]):Oe[t]=i}else if(1===arguments.length){if(Array.isArray(t))return t.map((function(t){Array.isArray(t)?Oe.apply(e,t):Oe(t)}));if("string"==typeof t){if(t in Oe)return Oe[t]}else"EPSG"in t?Oe["EPSG:"+t.EPSG]=t:"ESRI"in t?Oe["ESRI:"+t.ESRI]=t:"IAU2000"in t?Oe["IAU2000:"+t.IAU2000]=t:console.log(t);return}}(Ie=Oe)("EPSG:4326","+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees"),Ie("EPSG:4269","+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees"),Ie("EPSG:3857","+title=WGS 84 / Pseudo-Mercator +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +no_defs"),Ie.WGS84=Ie["EPSG:4326"],Ie["EPSG:3785"]=Ie["EPSG:3857"],Ie.GOOGLE=Ie["EPSG:3857"],Ie["EPSG:900913"]=Ie["EPSG:3857"],Ie["EPSG:102113"]=Ie["EPSG:3857"];var ze=["PROJECTEDCRS","PROJCRS","GEOGCS","GEOCCS","PROJCS","LOCAL_CS","GEODCRS","GEODETICCRS","GEODETICDATUM","ENGCRS","ENGINEERINGCRS"];var Re=["3857","900913","3785","102113"];function De(t){if(!function(t){return"string"==typeof t}(t))return t;if(function(t){return t in Oe}(t))return Oe[t];if(function(t){return ze.some((function(e){return t.indexOf(e)>-1}))}(t)){var e=Ae(t);if(function(t){var e=Me(t,"authority");if(e){var i=Me(e,"epsg");return i&&Re.indexOf(i)>-1}}(e))return Oe["EPSG:3857"];var i=function(t){var e=Me(t,"extension");if(e)return Me(e,"proj4")}(e);return i?Ce(i):e}return function(t){return"+"===t[0]}(t)?Ce(t):void 0}function Ne(t,e){var i,s;if(t=t||{},!e)return t;for(s in e)void 0!==(i=e[s])&&(t[s]=i);return t}function Ge(t,e,i){var s=t*e;return i/Math.sqrt(1-s*s)}function Ve(t){return t<0?-1:1}function je(t){return Math.abs(t)<=_e?t:t-Ve(t)*fe}function Fe(t,e,i){var s=t*i,r=.5*t;return s=Math.pow((1-s)/(1+s),r),Math.tan(.5*(ce-e))/s}function We(t,e){for(var i,s,r=.5*t,a=ce-2*Math.atan(e),n=0;n<=15;n++)if(i=t*Math.sin(a),a+=s=ce-2*Math.atan(e*Math.pow((1-i)/(1+i),r))-a,Math.abs(s)<=1e-10)return a;return-9999}function qe(t){return t}var Be=[{init:function(){var t=this.b/this.a;this.es=1-t*t,!("x0"in this)&&(this.x0=0),!("y0"in this)&&(this.y0=0),this.e=Math.sqrt(this.es),this.lat_ts?this.sphere?this.k0=Math.cos(this.lat_ts):this.k0=Ge(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)):!this.k0&&(this.k?this.k0=this.k:this.k0=1)},forward:function(t){var e,i,s=t.x,r=t.y;if(r*pe>90&&r*pe<-90&&s*pe>180&&s*pe<-180)return null;if(Math.abs(Math.abs(r)-ce)<=ue)return null;if(this.sphere)e=this.x0+this.a*this.k0*je(s-this.long0),i=this.y0+this.a*this.k0*Math.log(Math.tan(me+.5*r));else{var a=Math.sin(r),n=Fe(this.e,r,a);e=this.x0+this.a*this.k0*je(s-this.long0),i=this.y0-this.a*this.k0*Math.log(n)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,s=t.x-this.x0,r=t.y-this.y0;if(this.sphere)i=ce-2*Math.atan(Math.exp(-r/(this.a*this.k0)));else{var a=Math.exp(-r/(this.a*this.k0));if(-9999===(i=We(this.e,a)))return null}return e=je(this.long0+s/(this.a*this.k0)),t.x=e,t.y=i,t},names:["Mercator","Popular Visualisation Pseudo Mercator","Mercator_1SP","Mercator_Auxiliary_Sphere","merc"]},{init:function(){},forward:qe,inverse:qe,names:["longlat","identity"]}],He={},Ue=[];function Ke(t,e){var i=Ue.length;return t.names?(Ue[i]=t,t.names.forEach((function(t){He[t.toLowerCase()]=i})),this):(console.log(e),!0)}const Ze={start:function(){Be.forEach(Ke)},add:Ke,get:function(t){if(!t)return!1;var e=t.toLowerCase();return void 0!==He[e]&&Ue[He[e]]?Ue[He[e]]:void 0}};var Xe={MERIT:{a:6378137,rf:298.257,ellipseName:"MERIT 1983"},SGS85:{a:6378136,rf:298.257,ellipseName:"Soviet Geodetic System 85"},GRS80:{a:6378137,rf:298.257222101,ellipseName:"GRS 1980(IUGG, 1980)"},IAU76:{a:6378140,rf:298.257,ellipseName:"IAU 1976"},airy:{a:6377563.396,b:6356256.91,ellipseName:"Airy 1830"},APL4:{a:6378137,rf:298.25,ellipseName:"Appl. Physics. 1965"},NWL9D:{a:6378145,rf:298.25,ellipseName:"Naval Weapons Lab., 1965"},mod_airy:{a:6377340.189,b:6356034.446,ellipseName:"Modified Airy"},andrae:{a:6377104.43,rf:300,ellipseName:"Andrae 1876 (Den., Iclnd.)"},aust_SA:{a:6378160,rf:298.25,ellipseName:"Australian Natl & S. Amer. 1969"},GRS67:{a:6378160,rf:298.247167427,ellipseName:"GRS 67(IUGG 1967)"},bessel:{a:6377397.155,rf:299.1528128,ellipseName:"Bessel 1841"},bess_nam:{a:6377483.865,rf:299.1528128,ellipseName:"Bessel 1841 (Namibia)"},clrk66:{a:6378206.4,b:6356583.8,ellipseName:"Clarke 1866"},clrk80:{a:6378249.145,rf:293.4663,ellipseName:"Clarke 1880 mod."},clrk80ign:{a:6378249.2,b:6356515,rf:293.4660213,ellipseName:"Clarke 1880 (IGN)"},clrk58:{a:6378293.645208759,rf:294.2606763692654,ellipseName:"Clarke 1858"},CPM:{a:6375738.7,rf:334.29,ellipseName:"Comm. des Poids et Mesures 1799"},delmbr:{a:6376428,rf:311.5,ellipseName:"Delambre 1810 (Belgium)"},engelis:{a:6378136.05,rf:298.2566,ellipseName:"Engelis 1985"},evrst30:{a:6377276.345,rf:300.8017,ellipseName:"Everest 1830"},evrst48:{a:6377304.063,rf:300.8017,ellipseName:"Everest 1948"},evrst56:{a:6377301.243,rf:300.8017,ellipseName:"Everest 1956"},evrst69:{a:6377295.664,rf:300.8017,ellipseName:"Everest 1969"},evrstSS:{a:6377298.556,rf:300.8017,ellipseName:"Everest (Sabah & Sarawak)"},fschr60:{a:6378166,rf:298.3,ellipseName:"Fischer (Mercury Datum) 1960"},fschr60m:{a:6378155,rf:298.3,ellipseName:"Fischer 1960"},fschr68:{a:6378150,rf:298.3,ellipseName:"Fischer 1968"},helmert:{a:6378200,rf:298.3,ellipseName:"Helmert 1906"},hough:{a:6378270,rf:297,ellipseName:"Hough"},intl:{a:6378388,rf:297,ellipseName:"International 1909 (Hayford)"},kaula:{a:6378163,rf:298.24,ellipseName:"Kaula 1961"},lerch:{a:6378139,rf:298.257,ellipseName:"Lerch 1979"},mprts:{a:6397300,rf:191,ellipseName:"Maupertius 1738"},new_intl:{a:6378157.5,b:6356772.2,ellipseName:"New International 1967"},plessis:{a:6376523,rf:6355863,ellipseName:"Plessis 1817 (France)"},krass:{a:6378245,rf:298.3,ellipseName:"Krassovsky, 1942"},SEasia:{a:6378155,b:6356773.3205,ellipseName:"Southeast Asia"},walbeck:{a:6376896,b:6355834.8467,ellipseName:"Walbeck"},WGS60:{a:6378165,rf:298.3,ellipseName:"WGS 60"},WGS66:{a:6378145,rf:298.25,ellipseName:"WGS 66"},WGS7:{a:6378135,rf:298.26,ellipseName:"WGS 72"}},Je=Xe.WGS84={a:6378137,rf:298.257223563,ellipseName:"WGS 84"};Xe.sphere={a:6370997,b:6370997,ellipseName:"Normal Sphere (r=6370997)"};var Ye={};Ye.wgs84={towgs84:"0,0,0",ellipse:"WGS84",datumName:"WGS84"},Ye.ch1903={towgs84:"674.374,15.056,405.346",ellipse:"bessel",datumName:"swiss"},Ye.ggrs87={towgs84:"-199.87,74.79,246.62",ellipse:"GRS80",datumName:"Greek_Geodetic_Reference_System_1987"},Ye.nad83={towgs84:"0,0,0",ellipse:"GRS80",datumName:"North_American_Datum_1983"},Ye.nad27={nadgrids:"@conus,@alaska,@ntv2_0.gsb,@ntv1_can.dat",ellipse:"clrk66",datumName:"North_American_Datum_1927"},Ye.potsdam={towgs84:"598.1,73.7,418.2,0.202,0.045,-2.455,6.7",ellipse:"bessel",datumName:"Potsdam Rauenberg 1950 DHDN"},Ye.carthage={towgs84:"-263.0,6.0,431.0",ellipse:"clark80",datumName:"Carthage 1934 Tunisia"},Ye.hermannskogel={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Hermannskogel"},Ye.militargeographische_institut={towgs84:"577.326,90.129,463.919,5.137,1.474,5.297,2.4232",ellipse:"bessel",datumName:"Militar-Geographische Institut"},Ye.osni52={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"airy",datumName:"Irish National"},Ye.ire65={towgs84:"482.530,-130.596,564.557,-1.042,-0.214,-0.631,8.15",ellipse:"mod_airy",datumName:"Ireland 1965"},Ye.rassadiran={towgs84:"-133.63,-157.5,-158.62",ellipse:"intl",datumName:"Rassadiran"},Ye.nzgd49={towgs84:"59.47,-5.04,187.44,0.47,-0.1,1.024,-4.5993",ellipse:"intl",datumName:"New Zealand Geodetic Datum 1949"},Ye.osgb36={towgs84:"446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894",ellipse:"airy",datumName:"Airy 1830"},Ye.s_jtsk={towgs84:"589,76,480",ellipse:"bessel",datumName:"S-JTSK (Ferro)"},Ye.beduaram={towgs84:"-106,-87,188",ellipse:"clrk80",datumName:"Beduaram"},Ye.gunung_segara={towgs84:"-403,684,41",ellipse:"bessel",datumName:"Gunung Segara Jakarta"},Ye.rnb72={towgs84:"106.869,-52.2978,103.724,-0.33657,0.456955,-1.84218,1",ellipse:"intl",datumName:"Reseau National Belge 1972"};var Qe={};function $e(t){if(0===t.length)return null;var e="@"===t[0];return e&&(t=t.slice(1)),"null"===t?{name:"null",mandatory:!e,grid:null,isNull:!0}:{name:t,mandatory:!e,grid:Qe[t]||null,isNull:!1}}function ti(t){return t/3600*Math.PI/180}function ei(t,e,i){return String.fromCharCode.apply(null,new Uint8Array(t.buffer.slice(e,i)))}function ii(t){return t.map((function(t){return[ti(t.longitudeShift),ti(t.latitudeShift)]}))}function si(t,e,i){return{name:ei(t,e+8,e+16).trim(),parent:ei(t,e+24,e+24+8).trim(),lowerLatitude:t.getFloat64(e+72,i),upperLatitude:t.getFloat64(e+88,i),lowerLongitude:t.getFloat64(e+104,i),upperLongitude:t.getFloat64(e+120,i),latitudeInterval:t.getFloat64(e+136,i),longitudeInterval:t.getFloat64(e+152,i),gridNodeCount:t.getInt32(e+168,i)}}function ri(t,e,i,s){for(var r=e+176,a=[],n=0;n<i.gridNodeCount;n++){var o={latitudeShift:t.getFloat32(r+16*n,s),longitudeShift:t.getFloat32(r+16*n+4,s),latitudeAccuracy:t.getFloat32(r+16*n+8,s),longitudeAccuracy:t.getFloat32(r+16*n+12,s)};a.push(o)}return a}function ai(t,e){if(!(this instanceof ai))return new ai(t);e=e||function(t){if(t)throw t};var i=De(t);if("object"==typeof i){var s=ai.projections.get(i.projName);if(s){if(i.datumCode&&"none"!==i.datumCode){var r=Me(Ye,i.datumCode);r&&(i.datum_params=i.datum_params||(r.towgs84?r.towgs84.split(","):null),i.ellps=r.ellipse,i.datumName=r.datumName?r.datumName:i.datumCode)}i.k0=i.k0||1,i.axis=i.axis||"enu",i.ellps=i.ellps||"wgs84",i.lat1=i.lat1||i.lat0;var a,n=function(t,e,i,s,r){if(!t){var a=Me(Xe,s);!a&&(a=Je),t=a.a,e=a.b,i=a.rf}return i&&!e&&(e=(1-1/i)*t),(0===i||Math.abs(t-e)<ue)&&(r=!0,e=t),{a:t,b:e,rf:i,sphere:r}}(i.a,i.b,i.rf,i.ellps,i.sphere),o=function(t,e,i,s){var r=t*t,a=e*e,n=(r-a)/r,o=0;return s?(r=(t*=1-n*(.16666666666666666+n*(.04722222222222222+.022156084656084655*n)))*t,n=0):o=Math.sqrt(n),{es:n,e:o,ep2:(r-a)/a}}(n.a,n.b,n.rf,i.R_A),l=void 0===(a=i.nadgrids)?null:a.split(",").map($e),h=i.datum||function(t,e,i,s,r,a,n){var o={};return o.datum_type=void 0===t||"none"===t?5:4,e&&(o.datum_params=e.map(parseFloat),(0!==o.datum_params[0]||0!==o.datum_params[1]||0!==o.datum_params[2])&&(o.datum_type=1),o.datum_params.length>3&&(0!==o.datum_params[3]||0!==o.datum_params[4]||0!==o.datum_params[5]||0!==o.datum_params[6])&&(o.datum_type=2,o.datum_params[3]*=he,o.datum_params[4]*=he,o.datum_params[5]*=he,o.datum_params[6]=o.datum_params[6]/1e6+1)),n&&(o.datum_type=3,o.grids=n),o.a=i,o.b=s,o.es=r,o.ep2=a,o}(i.datumCode,i.datum_params,n.a,n.b,o.es,o.ep2,l);Ne(this,i),Ne(this,s),this.a=n.a,this.b=n.b,this.rf=n.rf,this.sphere=n.sphere,this.es=o.es,this.e=o.e,this.ep2=o.ep2,this.datum=h,this.init(),e(null,this)}else e("Could not get projection name from: "+t)}else e("Could not parse to valid json: "+t)}function ni(t,e,i){var s,r,a,n,o=t.x,l=t.y,h=t.z?t.z:0;if(l<-ce&&l>-1.001*ce)l=-ce;else if(l>ce&&l<1.001*ce)l=ce;else{if(l<-ce)return{x:-1/0,y:-1/0,z:t.z};if(l>ce)return{x:1/0,y:1/0,z:t.z}}return o>Math.PI&&(o-=2*Math.PI),r=Math.sin(l),n=Math.cos(l),a=r*r,{x:((s=i/Math.sqrt(1-e*a))+h)*n*Math.cos(o),y:(s+h)*n*Math.sin(o),z:(s*(1-e)+h)*r}}function oi(t,e,i,s){var r,a,n,o,l,h,c,u,d,p,m,f,_,y,g,v=1e-12,M=t.x,C=t.y,x=t.z?t.z:0;if(r=Math.sqrt(M*M+C*C),a=Math.sqrt(M*M+C*C+x*x),r/i<v){if(y=0,a/i<v)return g=-s,{x:t.x,y:t.y,z:t.z}}else y=Math.atan2(C,M);n=x/a,u=(o=r/a)*(1-e)*(l=1/Math.sqrt(1-e*(2-e)*o*o)),d=n*l,_=0;do{_++,h=e*(c=i/Math.sqrt(1-e*d*d))/(c+(g=r*u+x*d-c*(1-e*d*d))),f=(m=n*(l=1/Math.sqrt(1-h*(2-h)*o*o)))*u-(p=o*(1-h)*l)*d,u=p,d=m}while(f*f>1e-24&&_<30);return{x:y,y:Math.atan(m/Math.abs(p)),z:g}}function li(t){return 1===t||2===t}function hi(t,e,i){if(r=e,(s=t).datum_type===r.datum_type&&!(s.a!==r.a||Math.abs(s.es-r.es)>5e-11)&&(1===s.datum_type?s.datum_params[0]===r.datum_params[0]&&s.datum_params[1]===r.datum_params[1]&&s.datum_params[2]===r.datum_params[2]:2!==s.datum_type||s.datum_params[0]===r.datum_params[0]&&s.datum_params[1]===r.datum_params[1]&&s.datum_params[2]===r.datum_params[2]&&s.datum_params[3]===r.datum_params[3]&&s.datum_params[4]===r.datum_params[4]&&s.datum_params[5]===r.datum_params[5]&&s.datum_params[6]===r.datum_params[6]))return i;var s,r;if(5===t.datum_type||5===e.datum_type)return i;var a=t.a,n=t.es;if(3===t.datum_type){if(0!==ci(t,!1,i))return;a=oe,n=le}var o=e.a,l=e.b,h=e.es;if(3===e.datum_type&&(o=oe,l=6356752.314,h=le),n===h&&a===o&&!li(t.datum_type)&&!li(e.datum_type))return i;if((i=ni(i,n,a),li(t.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x+i[0],y:t.y+i[1],z:t.z+i[2]};if(2===e){var s=i[0],r=i[1],a=i[2],n=i[3],o=i[4],l=i[5],h=i[6];return{x:h*(t.x-l*t.y+o*t.z)+s,y:h*(l*t.x+t.y-n*t.z)+r,z:h*(-o*t.x+n*t.y+t.z)+a}}}(i,t.datum_type,t.datum_params)),li(e.datum_type)&&(i=function(t,e,i){if(1===e)return{x:t.x-i[0],y:t.y-i[1],z:t.z-i[2]};if(2===e){var s=i[0],r=i[1],a=i[2],n=i[3],o=i[4],l=i[5],h=i[6],c=(t.x-s)/h,u=(t.y-r)/h,d=(t.z-a)/h;return{x:c+l*u-o*d,y:-l*c+u+n*d,z:o*c-n*u+d}}}(i,e.datum_type,e.datum_params)),i=oi(i,h,o,l),3===e.datum_type)&&0!==ci(e,!0,i))return;return i}function ci(t,e,i){if(null===t.grids||0===t.grids.length)return console.log("Grid shift grids not found"),-1;var s={x:-i.x,y:i.y},r={x:Number.NaN,y:Number.NaN},a=[];t:for(var n=0;n<t.grids.length;n++){var o=t.grids[n];if(a.push(o.name),o.isNull){r=s;break}if(o.mandatory,null!==o.grid)for(var l=o.grid.subgrids,h=0,c=l.length;h<c;h++){var u=l[h],d=(Math.abs(u.del[1])+Math.abs(u.del[0]))/1e4,p=u.ll[0]-d,m=u.ll[1]-d,f=u.ll[0]+(u.lim[0]-1)*u.del[0]+d,_=u.ll[1]+(u.lim[1]-1)*u.del[1]+d;if(!(m>s.y||p>s.x||_<s.y||f<s.x)&&(r=ui(s,e,u),!isNaN(r.x)))break t}else if(o.mandatory)return console.log("Unable to find mandatory grid '"+o.name+"'"),-1}return isNaN(r.x)?(console.log("Failed to find a grid shift table for location '"+-s.x*pe+" "+s.y*pe+" tried: '"+a+"'"),-1):(i.x=-r.x,i.y=r.y,0)}function ui(t,e,i){var s={x:Number.NaN,y:Number.NaN};if(isNaN(t.x))return s;var r={x:t.x,y:t.y};r.x-=i.ll[0],r.y-=i.ll[1],r.x=je(r.x-Math.PI)+Math.PI;var a=di(r,i);if(e){if(isNaN(a.x))return s;a.x=r.x-a.x,a.y=r.y-a.y;var n,o,l=9;do{if(o=di(a,i),isNaN(o.x)){console.log("Inverse grid shift iteration failed, presumably at grid edge.  Using first approximation.");break}n={x:r.x-(o.x+a.x),y:r.y-(o.y+a.y)},a.x+=n.x,a.y+=n.y}while(l--&&Math.abs(n.x)>1e-12&&Math.abs(n.y)>1e-12);if(l<0)return console.log("Inverse grid shift iterator failed to converge."),s;s.x=je(a.x+i.ll[0]),s.y=a.y+i.ll[1]}else!isNaN(a.x)&&(s.x=t.x+a.x,s.y=t.y+a.y);return s}function di(t,e){var i,s={x:t.x/e.del[0],y:t.y/e.del[1]},r=Math.floor(s.x),a=Math.floor(s.y),n=s.x-1*r,o=s.y-1*a,l={x:Number.NaN,y:Number.NaN};if(r<0||r>=e.lim[0])return l;if(a<0||a>=e.lim[1])return l;i=a*e.lim[0]+r;var h=e.cvs[i][0],c=e.cvs[i][1];i++;var u=e.cvs[i][0],d=e.cvs[i][1];i+=e.lim[0];var p=e.cvs[i][0],m=e.cvs[i][1];i--;var f=e.cvs[i][0],_=e.cvs[i][1],y=n*o,g=n*(1-o),v=(1-n)*(1-o),M=(1-n)*o;return l.x=v*h+g*u+M*f+y*p,l.y=v*c+g*d+M*_+y*m,l}function pi(t,e,i){var s,r,a,n=i.x,o=i.y,l=i.z||0,h={};for(a=0;a<3;a++)if(!e||2!==a||void 0!==i.z)switch(0===a?(s=n,r=-1!=="ew".indexOf(t.axis[a])?"x":"y"):1===a?(s=o,r=-1!=="ns".indexOf(t.axis[a])?"y":"x"):(s=l,r="z"),t.axis[a]){case"e":case"n":h[r]=s;break;case"w":case"s":h[r]=-s;break;case"u":void 0!==i[r]&&(h.z=s);break;case"d":void 0!==i[r]&&(h.z=-s);break;default:return null}return h}function mi(t){var e={x:t[0],y:t[1]};return t.length>2&&(e.z=t[2]),t.length>3&&(e.m=t[3]),e}function fi(t){if("function"==typeof Number.isFinite){if(Number.isFinite(t))return;throw new TypeError("coordinates must be finite numbers")}if("number"!=typeof t||t!=t||!isFinite(t))throw new TypeError("coordinates must be finite numbers")}function _i(t,e,i,s){var r,a,n=void 0!==(i=Array.isArray(i)?mi(i):{x:i.x,y:i.y,z:i.z,m:i.m}).z;if(fi((a=i).x),fi(a.y),t.datum&&e.datum&&function(t,e){return(1===t.datum.datum_type||2===t.datum.datum_type||3===t.datum.datum_type)&&"WGS84"!==e.datumCode||(1===e.datum.datum_type||2===e.datum.datum_type||3===e.datum.datum_type)&&"WGS84"!==t.datumCode}(t,e)&&(i=_i(t,r=new ai("WGS84"),i,s),t=r),s&&"enu"!==t.axis&&(i=pi(t,!1,i)),"longlat"===t.projName)i={x:i.x*de,y:i.y*de,z:i.z||0};else if(t.to_meter&&(i={x:i.x*t.to_meter,y:i.y*t.to_meter,z:i.z||0}),!(i=t.inverse(i)))return;if(t.from_greenwich&&(i.x+=t.from_greenwich),i=hi(t.datum,e.datum,i))return e.from_greenwich&&(i={x:i.x-e.from_greenwich,y:i.y,z:i.z||0}),"longlat"===e.projName?i={x:i.x*pe,y:i.y*pe,z:i.z||0}:(i=e.forward(i),e.to_meter&&(i={x:i.x/e.to_meter,y:i.y/e.to_meter,z:i.z||0})),s&&"enu"!==e.axis?pi(e,!0,i):(i&&!n&&delete i.z,i)}ai.projections=Ze,ai.projections.start();var yi=ai("WGS84");function gi(t,e,i,s){var r,a,n;return Array.isArray(i)?(r=_i(t,e,i,s)||{x:NaN,y:NaN},i.length>2?void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name?"number"==typeof r.z?[r.x,r.y,r.z].concat(i.slice(3)):[r.x,r.y,i[2]].concat(i.slice(3)):[r.x,r.y].concat(i.slice(2)):[r.x,r.y]):(a=_i(t,e,i,s),2===(n=Object.keys(i)).length||n.forEach((function(s){if(void 0!==t.name&&"geocent"===t.name||void 0!==e.name&&"geocent"===e.name){if("x"===s||"y"===s||"z"===s)return}else if("x"===s||"y"===s)return;a[s]=i[s]})),a)}function vi(t){return t instanceof ai?t:t.oProj?t.oProj:ai(t)}function Mi(t,e,i){t=vi(t);var s,r=!1;return void 0===e?(e=t,t=yi,r=!0):(void 0!==e.x||Array.isArray(e))&&(i=e,e=t,t=yi,r=!0),e=vi(e),i?gi(t,e,i):(s={forward:function(i,s){return gi(t,e,i,s)},inverse:function(i,s){return gi(e,t,i,s)}},r&&(s.oProj=e),s)}var Ci="AJSAJS",xi="AFAFAF",bi=65,wi=73,Pi=79,Si=86,Ti=90;const Ei={forward:ki,inverse:function(t){var e=Oi(Di(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat,e.lon,e.lat]:[e.left,e.bottom,e.right,e.top]},toPoint:Ii};function ki(t,e){return e=e||5,function(t,e){var i="00000"+t.easting,s="00000"+t.northing;return t.zoneNumber+t.zoneLetter+function(t,e,i){var s=Ri(i),r=Math.floor(t/1e5),a=Math.floor(e/1e5)%20;return function(t,e,i){var s=i-1,r=Ci.charCodeAt(s),a=xi.charCodeAt(s),n=r+t-1,o=a+e,l=!1;return n>Ti&&(n=n-Ti+bi-1,l=!0),(n===wi||r<wi&&n>wi||(n>wi||r<wi)&&l)&&n++,(n===Pi||r<Pi&&n>Pi||(n>Pi||r<Pi)&&l)&&++n===wi&&n++,n>Ti&&(n=n-Ti+bi-1),o>Si?(o=o-Si+bi-1,l=!0):l=!1,(o===wi||a<wi&&o>wi||(o>wi||a<wi)&&l)&&o++,(o===Pi||a<Pi&&o>Pi||(o>Pi||a<Pi)&&l)&&++o===wi&&o++,o>Si&&(o=o-Si+bi-1),String.fromCharCode(n)+String.fromCharCode(o)}(r,a,s)}(t.easting,t.northing,t.zoneNumber)+i.substr(i.length-5,e)+s.substr(s.length-5,e)}(function(t){var e,i,s,r,a,n,o,l,h=t.lat,c=t.lon,u=6378137,d=.00669438,p=.9996,m=Li(h),f=Li(c);l=Math.floor((c+180)/6)+1,180===c&&(l=60),h>=56&&h<64&&c>=3&&c<12&&(l=32),h>=72&&h<84&&(c>=0&&c<9?l=31:c>=9&&c<21?l=33:c>=21&&c<33?l=35:c>=33&&c<42&&(l=37));o=Li(6*(l-1)-180+3),e=d/(1-d),i=u/Math.sqrt(1-d*Math.sin(m)*Math.sin(m)),s=Math.tan(m)*Math.tan(m),r=e*Math.cos(m)*Math.cos(m),a=Math.cos(m)*(f-o),n=u*((1-d/4-3*d*d/64-5*d*d*d/256)*m-(3*d/8+3*d*d/32+45*d*d*d/1024)*Math.sin(2*m)+(15*d*d/256+45*d*d*d/1024)*Math.sin(4*m)-35*d*d*d/3072*Math.sin(6*m));var _=p*i*(a+(1-s+r)*a*a*a/6+(5-18*s+s*s+72*r-58*e)*a*a*a*a*a/120)+5e5,y=p*(n+i*Math.tan(m)*(a*a/2+(5-s+9*r+4*r*r)*a*a*a*a/24+(61-58*s+s*s+600*r-330*e)*a*a*a*a*a*a/720));return h<0&&(y+=1e7),{northing:Math.round(y),easting:Math.round(_),zoneNumber:l,zoneLetter:zi(h)}}({lat:t[1],lon:t[0]}),e)}function Ii(t){var e=Oi(Di(t.toUpperCase()));return e.lat&&e.lon?[e.lon,e.lat]:[(e.left+e.right)/2,(e.top+e.bottom)/2]}function Li(t){return t*(Math.PI/180)}function Ai(t){return t/Math.PI*180}function Oi(t){var e=t.northing,i=t.easting,s=t.zoneLetter,r=t.zoneNumber;if(r<0||r>60)return null;var a,n,o,l,h,c,u,d,p,m=.9996,f=6378137,_=.00669438,y=(1-Math.sqrt(1-_))/(1+Math.sqrt(1-_)),g=i-5e5,v=e;s<"N"&&(v-=1e7),u=6*(r-1)-180+3,a=_/(1-_),p=(d=v/m/6367449.145945056)+(3*y/2-27*y*y*y/32)*Math.sin(2*d)+(21*y*y/16-55*y*y*y*y/32)*Math.sin(4*d)+151*y*y*y/96*Math.sin(6*d),n=f/Math.sqrt(1-_*Math.sin(p)*Math.sin(p)),o=Math.tan(p)*Math.tan(p),l=a*Math.cos(p)*Math.cos(p),h=f*(1-_)/Math.pow(1-_*Math.sin(p)*Math.sin(p),1.5),c=g/(n*m);var M=p-n*Math.tan(p)/h*(c*c/2-(5+3*o+10*l-4*l*l-9*a)*c*c*c*c/24+(61+90*o+298*l+45*o*o-252*a-3*l*l)*c*c*c*c*c*c/720);M=Ai(M);var C,x=(c-(1+2*o+l)*c*c*c/6+(5-2*l+28*o-3*l*l+8*a+24*o*o)*c*c*c*c*c/120)/Math.cos(p);if(x=u+Ai(x),t.accuracy){var b=Oi({northing:t.northing+t.accuracy,easting:t.easting+t.accuracy,zoneLetter:t.zoneLetter,zoneNumber:t.zoneNumber});C={top:b.lat,right:b.lon,bottom:M,left:x}}else C={lat:M,lon:x};return C}function zi(t){var e="Z";return 84>=t&&t>=72?e="X":72>t&&t>=64?e="W":64>t&&t>=56?e="V":56>t&&t>=48?e="U":48>t&&t>=40?e="T":40>t&&t>=32?e="S":32>t&&t>=24?e="R":24>t&&t>=16?e="Q":16>t&&t>=8?e="P":8>t&&t>=0?e="N":0>t&&t>=-8?e="M":-8>t&&t>=-16?e="L":-16>t&&t>=-24?e="K":-24>t&&t>=-32?e="J":-32>t&&t>=-40?e="H":-40>t&&t>=-48?e="G":-48>t&&t>=-56?e="F":-56>t&&t>=-64?e="E":-64>t&&t>=-72?e="D":-72>t&&t>=-80&&(e="C"),e}function Ri(t){var e=t%6;return 0===e&&(e=6),e}function Di(t){if(t&&0===t.length)throw"MGRSPoint coverting from nothing";for(var e,i=t.length,s=null,r="",a=0;!/[A-Z]/.test(e=t.charAt(a));){if(a>=2)throw"MGRSPoint bad conversion from: "+t;r+=e,a++}var n=parseInt(r,10);if(0===a||a+3>i)throw"MGRSPoint bad conversion from: "+t;var o=t.charAt(a++);if(o<="A"||"B"===o||"Y"===o||o>="Z"||"I"===o||"O"===o)throw"MGRSPoint zone letter "+o+" not handled: "+t;s=t.substring(a,a+=2);for(var l=Ri(n),h=function(t,e){var i=Ci.charCodeAt(e-1),s=1e5,r=!1;for(;i!==t.charCodeAt(0);){if(++i===wi&&i++,i===Pi&&i++,i>Ti){if(r)throw"Bad character: "+t;i=bi,r=!0}s+=1e5}return s}(s.charAt(0),l),c=function(t,e){if(t>"V")throw"MGRSPoint given invalid Northing "+t;var i=xi.charCodeAt(e-1),s=0,r=!1;for(;i!==t.charCodeAt(0);){if(++i===wi&&i++,i===Pi&&i++,i>Si){if(r)throw"Bad character: "+t;i=bi,r=!0}s+=1e5}return s}(s.charAt(1),l);c<Ni(o);)c+=2e6;var u=i-a;if(u%2!=0)throw"MGRSPoint has to have an even number \nof digits after the zone letter and two 100km letters - front \nhalf for easting meters, second half for \nnorthing meters"+t;var d,p,m,f=u/2,_=0,y=0;return f>0&&(d=1e5/Math.pow(10,f),p=t.substring(a,a+f),_=parseFloat(p)*d,m=t.substring(a+f),y=parseFloat(m)*d),{easting:_+h,northing:y+c,zoneLetter:o,zoneNumber:n,accuracy:d}}function Ni(t){var e;switch(t){case"C":e=11e5;break;case"D":e=2e6;break;case"E":e=28e5;break;case"F":e=37e5;break;case"G":e=46e5;break;case"H":e=55e5;break;case"J":e=64e5;break;case"K":e=73e5;break;case"L":e=82e5;break;case"M":e=91e5;break;case"N":e=0;break;case"P":e=8e5;break;case"Q":e=17e5;break;case"R":e=26e5;break;case"S":e=35e5;break;case"T":e=44e5;break;case"U":e=53e5;break;case"V":e=62e5;break;case"W":e=7e6;break;case"X":e=79e5;break;default:e=-1}if(e>=0)return e;throw"Invalid zone letter: "+t}function Gi(t,e,i){if(!(this instanceof Gi))return new Gi(t,e,i);if(Array.isArray(t))this.x=t[0],this.y=t[1],this.z=t[2]||0;else if("object"==typeof t)this.x=t.x,this.y=t.y,this.z=t.z||0;else if("string"==typeof t&&void 0===e){var s=t.split(",");this.x=parseFloat(s[0],10),this.y=parseFloat(s[1],10),this.z=parseFloat(s[2],10)||0}else this.x=t,this.y=e,this.z=i||0;console.warn("proj4.Point will be removed in version 3, use proj4.toPoint")}Gi.fromMGRS=function(t){return new Gi(Ii(t))},Gi.prototype.toMGRS=function(t){return ki([this.x,this.y],t)};var Vi=.046875,ji=.01953125,Fi=.01068115234375;function Wi(t){var e=[];e[0]=1-t*(.25+t*(Vi+t*(ji+t*Fi))),e[1]=t*(.75-t*(Vi+t*(ji+t*Fi)));var i=t*t;return e[2]=i*(.46875-t*(.013020833333333334+.007120768229166667*t)),i*=t,e[3]=i*(.3645833333333333-.005696614583333333*t),e[4]=i*t*.3076171875,e}function qi(t,e,i,s){return i*=e,e*=e,s[0]*t-i*(s[1]+e*(s[2]+e*(s[3]+e*s[4])))}function Bi(t,e,i){for(var s=1/(1-e),r=t,a=20;a;--a){var n=Math.sin(r),o=1-e*n*n;if(r-=o=(qi(r,n,Math.cos(r),i)-t)*(o*Math.sqrt(o))*s,Math.abs(o)<ue)return r}return r}const Hi={init:function(){this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.es&&(this.en=Wi(this.es),this.ml0=qi(this.lat0,Math.sin(this.lat0),Math.cos(this.lat0),this.en))},forward:function(t){var e,i,s,r=t.x,a=t.y,n=je(r-this.long0),o=Math.sin(a),l=Math.cos(a);if(this.es){var h=l*n,c=Math.pow(h,2),u=this.ep2*Math.pow(l,2),d=Math.pow(u,2),p=Math.abs(l)>ue?Math.tan(a):0,m=Math.pow(p,2),f=Math.pow(m,2);e=1-this.es*Math.pow(o,2),h/=Math.sqrt(e);var _=qi(a,o,l,this.en);i=this.a*(this.k0*h*(1+c/6*(1-m+u+c/20*(5-18*m+f+14*u-58*m*u+c/42*(61+179*f-f*m-479*m)))))+this.x0,s=this.a*(this.k0*(_-this.ml0+o*n*h/2*(1+c/12*(5-m+9*u+4*d+c/30*(61+f-58*m+270*u-330*m*u+c/56*(1385+543*f-f*m-3111*m))))))+this.y0}else{var y=l*Math.sin(n);if(Math.abs(Math.abs(y)-1)<ue)return 93;if(i=.5*this.a*this.k0*Math.log((1+y)/(1-y))+this.x0,s=l*Math.cos(n)/Math.sqrt(1-Math.pow(y,2)),(y=Math.abs(s))>=1){if(y-1>ue)return 93;s=0}else s=Math.acos(s);a<0&&(s=-s),s=this.a*this.k0*(s-this.lat0)+this.y0}return t.x=i,t.y=s,t},inverse:function(t){var e,i,s,r,a=(t.x-this.x0)*(1/this.a),n=(t.y-this.y0)*(1/this.a);if(this.es)if(i=Bi(e=this.ml0+n/this.k0,this.es,this.en),Math.abs(i)<ce){var o=Math.sin(i),l=Math.cos(i),h=Math.abs(l)>ue?Math.tan(i):0,c=this.ep2*Math.pow(l,2),u=Math.pow(c,2),d=Math.pow(h,2),p=Math.pow(d,2);e=1-this.es*Math.pow(o,2);var m=a*Math.sqrt(e)/this.k0,f=Math.pow(m,2);s=i-(e*=h)*f/(1-this.es)*.5*(1-f/12*(5+3*d-9*c*d+c-4*u-f/30*(61+90*d-252*c*d+45*p+46*c-f/56*(1385+3633*d+4095*p+1574*p*d)))),r=je(this.long0+m*(1-f/6*(1+2*d+c-f/20*(5+28*d+24*p+8*c*d+6*c-f/42*(61+662*d+1320*p+720*p*d))))/l)}else s=ce*Ve(n),r=0;else{var _=Math.exp(a/this.k0),y=.5*(_-1/_),g=this.lat0+n/this.k0,v=Math.cos(g);e=Math.sqrt((1-Math.pow(v,2))/(1+Math.pow(y,2))),s=Math.asin(e),n<0&&(s=-s),r=0===y&&0===v?0:je(Math.atan2(y,v)+this.long0)}return t.x=r,t.y=s,t},names:["Fast_Transverse_Mercator","Fast Transverse Mercator"]};function Ui(t){var e=Math.exp(t);return e=(e-1/e)/2}function Ki(t,e){t=Math.abs(t),e=Math.abs(e);var i=Math.max(t,e),s=Math.min(t,e)/(i||1);return i*Math.sqrt(1+Math.pow(s,2))}function Zi(t){var e=Math.abs(t);return e=function(t){var e=1+t,i=e-1;return 0===i?t:t*Math.log(e)/i}(e*(1+e/(Ki(1,e)+1))),t<0?-e:e}function Xi(t,e){for(var i,s=2*Math.cos(2*e),r=t.length-1,a=t[r],n=0;--r>=0;)i=s*a-n+t[r],n=a,a=i;return e+i*Math.sin(2*e)}function Ji(t,e,i){for(var s,r,a=Math.sin(e),n=Math.cos(e),o=Ui(i),l=function(t){var e=Math.exp(t);return(e+1/e)/2}(i),h=2*n*l,c=-2*a*o,u=t.length-1,d=t[u],p=0,m=0,f=0;--u>=0;)s=m,r=p,d=h*(m=d)-s-c*(p=f)+t[u],f=c*m-r+h*p;return[(h=a*l)*d-(c=n*o)*f,h*f+c*d]}const Yi={init:function(){if(!this.approx&&(isNaN(this.es)||this.es<=0))throw new Error('Incorrect elliptical usage. Try using the +approx option in the proj string, or PROJECTION["Fast_Transverse_Mercator"] in the WKT.');this.approx&&(Hi.init.apply(this),this.forward=Hi.forward,this.inverse=Hi.inverse),this.x0=void 0!==this.x0?this.x0:0,this.y0=void 0!==this.y0?this.y0:0,this.long0=void 0!==this.long0?this.long0:0,this.lat0=void 0!==this.lat0?this.lat0:0,this.cgb=[],this.cbg=[],this.utg=[],this.gtu=[];var t=this.es/(1+Math.sqrt(1-this.es)),e=t/(2-t),i=e;this.cgb[0]=e*(2+e*(-2/3+e*(e*(116/45+e*(26/45+e*(-2854/675)))-2))),this.cbg[0]=e*(e*(2/3+e*(4/3+e*(-82/45+e*(32/45+e*(4642/4725)))))-2),i*=e,this.cgb[1]=i*(7/3+e*(e*(-227/45+e*(2704/315+e*(2323/945)))-1.6)),this.cbg[1]=i*(5/3+e*(-16/15+e*(-13/9+e*(904/315+e*(-1522/945))))),i*=e,this.cgb[2]=i*(56/15+e*(-136/35+e*(-1262/105+e*(73814/2835)))),this.cbg[2]=i*(-26/15+e*(34/21+e*(1.6+e*(-12686/2835)))),i*=e,this.cgb[3]=i*(4279/630+e*(-332/35+e*(-399572/14175))),this.cbg[3]=i*(1237/630+e*(e*(-24832/14175)-2.4)),i*=e,this.cgb[4]=i*(4174/315+e*(-144838/6237)),this.cbg[4]=i*(-734/315+e*(109598/31185)),i*=e,this.cgb[5]=i*(601676/22275),this.cbg[5]=i*(444337/155925),i=Math.pow(e,2),this.Qn=this.k0/(1+e)*(1+i*(1/4+i*(1/64+i/256))),this.utg[0]=e*(e*(2/3+e*(-37/96+e*(1/360+e*(81/512+e*(-96199/604800)))))-.5),this.gtu[0]=e*(.5+e*(-2/3+e*(5/16+e*(41/180+e*(-127/288+e*(7891/37800)))))),this.utg[1]=i*(-1/48+e*(-1/15+e*(437/1440+e*(-46/105+e*(1118711/3870720))))),this.gtu[1]=i*(13/48+e*(e*(557/1440+e*(281/630+e*(-1983433/1935360)))-.6)),i*=e,this.utg[2]=i*(-17/480+e*(37/840+e*(209/4480+e*(-5569/90720)))),this.gtu[2]=i*(61/240+e*(-103/140+e*(15061/26880+e*(167603/181440)))),i*=e,this.utg[3]=i*(-4397/161280+e*(11/504+e*(830251/7257600))),this.gtu[3]=i*(49561/161280+e*(-179/168+e*(6601661/7257600))),i*=e,this.utg[4]=i*(-4583/161280+e*(108847/3991680)),this.gtu[4]=i*(34729/80640+e*(-3418889/1995840)),i*=e,this.utg[5]=i*(-20648693/638668800),this.gtu[5]=.6650675310896665*i;var s=Xi(this.cbg,this.lat0);this.Zb=-this.Qn*(s+function(t,e){for(var i,s=2*Math.cos(e),r=t.length-1,a=t[r],n=0;--r>=0;)i=s*a-n+t[r],n=a,a=i;return Math.sin(e)*i}(this.gtu,2*s))},forward:function(t){var e=je(t.x-this.long0),i=t.y;i=Xi(this.cbg,i);var s=Math.sin(i),r=Math.cos(i),a=Math.sin(e),n=Math.cos(e);i=Math.atan2(s,n*r),e=Math.atan2(a*r,Ki(s,r*n)),e=Zi(Math.tan(e));var o,l,h=Ji(this.gtu,2*i,2*e);return i+=h[0],e+=h[1],Math.abs(e)<=2.623395162778?(o=this.a*(this.Qn*e)+this.x0,l=this.a*(this.Qn*i+this.Zb)+this.y0):(o=1/0,l=1/0),t.x=o,t.y=l,t},inverse:function(t){var e,i,s=(t.x-this.x0)*(1/this.a),r=(t.y-this.y0)*(1/this.a);if(r=(r-this.Zb)/this.Qn,s/=this.Qn,Math.abs(s)<=2.623395162778){var a=Ji(this.utg,2*r,2*s);r+=a[0],s+=a[1],s=Math.atan(Ui(s));var n=Math.sin(r),o=Math.cos(r),l=Math.sin(s),h=Math.cos(s);r=Math.atan2(n*h,Ki(l,h*o)),e=je((s=Math.atan2(l,h*o))+this.long0),i=Xi(this.cgb,r)}else e=1/0,i=1/0;return t.x=e,t.y=i,t},names:["Extended_Transverse_Mercator","Extended Transverse Mercator","etmerc","Transverse_Mercator","Transverse Mercator","Gauss Kruger","Gauss_Kruger","tmerc"]};const Qi={init:function(){var t=function(t,e){if(void 0===t){if((t=Math.floor(30*(je(e)+Math.PI)/Math.PI)+1)<0)return 0;if(t>60)return 60}return t}(this.zone,this.long0);if(void 0===t)throw new Error("unknown utm zone");this.lat0=0,this.long0=(6*Math.abs(t)-183)*de,this.x0=5e5,this.y0=this.utmSouth?1e7:0,this.k0=.9996,Yi.init.apply(this),this.forward=Yi.forward,this.inverse=Yi.inverse},names:["Universal Transverse Mercator System","utm"],dependsOn:"etmerc"};function $i(t,e){return Math.pow((1-t)/(1+t),e)}const ts={init:function(){var t=Math.sin(this.lat0),e=Math.cos(this.lat0);e*=e,this.rc=Math.sqrt(1-this.es)/(1-this.es*t*t),this.C=Math.sqrt(1+this.es*e*e/(1-this.es)),this.phic0=Math.asin(t/this.C),this.ratexp=.5*this.C*this.e,this.K=Math.tan(.5*this.phic0+me)/(Math.pow(Math.tan(.5*this.lat0+me),this.C)*$i(this.e*t,this.ratexp))},forward:function(t){var e=t.x,i=t.y;return t.y=2*Math.atan(this.K*Math.pow(Math.tan(.5*i+me),this.C)*$i(this.e*Math.sin(i),this.ratexp))-ce,t.x=this.C*e,t},inverse:function(t){for(var e=t.x/this.C,i=t.y,s=Math.pow(Math.tan(.5*i+me)/this.K,1/this.C),r=20;r>0&&(i=2*Math.atan(s*$i(this.e*Math.sin(t.y),-.5*this.e))-ce,!(Math.abs(i-t.y)<1e-14));--r)t.y=i;return r?(t.x=e,t.y=i,t):null},names:["gauss"]};const es={init:function(){ts.init.apply(this),this.rc&&(this.sinc0=Math.sin(this.phic0),this.cosc0=Math.cos(this.phic0),this.R2=2*this.rc,!this.title&&(this.title="Oblique Stereographic Alternative"))},forward:function(t){var e,i,s,r;return t.x=je(t.x-this.long0),ts.forward.apply(this,[t]),e=Math.sin(t.y),i=Math.cos(t.y),s=Math.cos(t.x),r=this.k0*this.R2/(1+this.sinc0*e+this.cosc0*i*s),t.x=r*i*Math.sin(t.x),t.y=r*(this.cosc0*e-this.sinc0*i*s),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){var e,i,s,r,a;if(t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,a=Ki(t.x,t.y)){var n=2*Math.atan2(a,this.R2);e=Math.sin(n),i=Math.cos(n),r=Math.asin(i*this.sinc0+t.y*e*this.cosc0/a),s=Math.atan2(t.x*e,a*this.cosc0*i-t.y*this.sinc0*e)}else r=this.phic0,s=0;return t.x=s,t.y=r,ts.inverse.apply(this,[t]),t.x=je(t.x+this.long0),t},names:["Stereographic_North_Pole","Oblique_Stereographic","sterea","Oblique Stereographic Alternative","Double_Stereographic"]};const is={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.coslat0=Math.cos(this.lat0),this.sinlat0=Math.sin(this.lat0),this.sphere?1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=ue&&(this.k0=.5*(1+Ve(this.lat0)*Math.sin(this.lat_ts))):(Math.abs(this.coslat0)<=ue&&(this.lat0>0?this.con=1:this.con=-1),this.cons=Math.sqrt(Math.pow(1+this.e,1+this.e)*Math.pow(1-this.e,1-this.e)),1===this.k0&&!isNaN(this.lat_ts)&&Math.abs(this.coslat0)<=ue&&Math.abs(Math.cos(this.lat_ts))>ue&&(this.k0=.5*this.cons*Ge(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts))/Fe(this.e,this.con*this.lat_ts,this.con*Math.sin(this.lat_ts))),this.ms1=Ge(this.e,this.sinlat0,this.coslat0),this.X0=2*Math.atan(this.ssfn_(this.lat0,this.sinlat0,this.e))-ce,this.cosX0=Math.cos(this.X0),this.sinX0=Math.sin(this.X0))},forward:function(t){var e,i,s,r,a,n,o=t.x,l=t.y,h=Math.sin(l),c=Math.cos(l),u=je(o-this.long0);return Math.abs(Math.abs(o-this.long0)-Math.PI)<=ue&&Math.abs(l+this.lat0)<=ue?(t.x=NaN,t.y=NaN,t):this.sphere?(e=2*this.k0/(1+this.sinlat0*h+this.coslat0*c*Math.cos(u)),t.x=this.a*e*c*Math.sin(u)+this.x0,t.y=this.a*e*(this.coslat0*h-this.sinlat0*c*Math.cos(u))+this.y0,t):(i=2*Math.atan(this.ssfn_(l,h,this.e))-ce,r=Math.cos(i),s=Math.sin(i),Math.abs(this.coslat0)<=ue?(a=Fe(this.e,l*this.con,this.con*h),n=2*this.a*this.k0*a/this.cons,t.x=this.x0+n*Math.sin(o-this.long0),t.y=this.y0-this.con*n*Math.cos(o-this.long0),t):(Math.abs(this.sinlat0)<ue?(e=2*this.a*this.k0/(1+r*Math.cos(u)),t.y=e*s):(e=2*this.a*this.k0*this.ms1/(this.cosX0*(1+this.sinX0*s+this.cosX0*r*Math.cos(u))),t.y=e*(this.cosX0*s-this.sinX0*r*Math.cos(u))+this.y0),t.x=e*r*Math.sin(u)+this.x0,t))},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,s,r,a,n=Math.sqrt(t.x*t.x+t.y*t.y);if(this.sphere){var o=2*Math.atan(n/(2*this.a*this.k0));return e=this.long0,i=this.lat0,n<=ue?(t.x=e,t.y=i,t):(i=Math.asin(Math.cos(o)*this.sinlat0+t.y*Math.sin(o)*this.coslat0/n),e=Math.abs(this.coslat0)<ue?this.lat0>0?je(this.long0+Math.atan2(t.x,-1*t.y)):je(this.long0+Math.atan2(t.x,t.y)):je(this.long0+Math.atan2(t.x*Math.sin(o),n*this.coslat0*Math.cos(o)-t.y*this.sinlat0*Math.sin(o))),t.x=e,t.y=i,t)}if(Math.abs(this.coslat0)<=ue){if(n<=ue)return i=this.lat0,e=this.long0,t.x=e,t.y=i,t;t.x*=this.con,t.y*=this.con,s=n*this.cons/(2*this.a*this.k0),i=this.con*We(this.e,s),e=this.con*je(this.con*this.long0+Math.atan2(t.x,-1*t.y))}else r=2*Math.atan(n*this.cosX0/(2*this.a*this.k0*this.ms1)),e=this.long0,n<=ue?a=this.X0:(a=Math.asin(Math.cos(r)*this.sinX0+t.y*Math.sin(r)*this.cosX0/n),e=je(this.long0+Math.atan2(t.x*Math.sin(r),n*this.cosX0*Math.cos(r)-t.y*this.sinX0*Math.sin(r)))),i=-1*We(this.e,Math.tan(.5*(ce+a)));return t.x=e,t.y=i,t},names:["stere","Stereographic_South_Pole","Polar Stereographic (variant B)","Polar_Stereographic"],ssfn_:function(t,e,i){return e*=i,Math.tan(.5*(ce+t))*Math.pow((1-e)/(1+e),.5*i)}};const ss={init:function(){var t=this.lat0;this.lambda0=this.long0;var e=Math.sin(t),i=this.a,s=1/this.rf,r=2*s-Math.pow(s,2),a=this.e=Math.sqrt(r);this.R=this.k0*i*Math.sqrt(1-r)/(1-r*Math.pow(e,2)),this.alpha=Math.sqrt(1+r/(1-r)*Math.pow(Math.cos(t),4)),this.b0=Math.asin(e/this.alpha);var n=Math.log(Math.tan(Math.PI/4+this.b0/2)),o=Math.log(Math.tan(Math.PI/4+t/2)),l=Math.log((1+a*e)/(1-a*e));this.K=n-this.alpha*o+this.alpha*a/2*l},forward:function(t){var e=Math.log(Math.tan(Math.PI/4-t.y/2)),i=this.e/2*Math.log((1+this.e*Math.sin(t.y))/(1-this.e*Math.sin(t.y))),s=-this.alpha*(e+i)+this.K,r=2*(Math.atan(Math.exp(s))-Math.PI/4),a=this.alpha*(t.x-this.lambda0),n=Math.atan(Math.sin(a)/(Math.sin(this.b0)*Math.tan(r)+Math.cos(this.b0)*Math.cos(a))),o=Math.asin(Math.cos(this.b0)*Math.sin(r)-Math.sin(this.b0)*Math.cos(r)*Math.cos(a));return t.y=this.R/2*Math.log((1+Math.sin(o))/(1-Math.sin(o)))+this.y0,t.x=this.R*n+this.x0,t},inverse:function(t){for(var e=t.x-this.x0,i=t.y-this.y0,s=e/this.R,r=2*(Math.atan(Math.exp(i/this.R))-Math.PI/4),a=Math.asin(Math.cos(this.b0)*Math.sin(r)+Math.sin(this.b0)*Math.cos(r)*Math.cos(s)),n=Math.atan(Math.sin(s)/(Math.cos(this.b0)*Math.cos(s)-Math.sin(this.b0)*Math.tan(r))),o=this.lambda0+n/this.alpha,l=0,h=a,c=-1e3,u=0;Math.abs(h-c)>1e-7;){if(++u>20)return;l=1/this.alpha*(Math.log(Math.tan(Math.PI/4+a/2))-this.K)+this.e*Math.log(Math.tan(Math.PI/4+Math.asin(this.e*Math.sin(h))/2)),c=h,h=2*Math.atan(Math.exp(l))-Math.PI/2}return t.x=o,t.y=h,t},names:["somerc"]};var rs=1e-7;const as={init:function(){var t,e,i,s,r,a,n,o,l,h,c,u=0,d=0,p=0,m=0,f=0,_=0,y=0;this.no_off=function(t){var e="object"==typeof t.PROJECTION?Object.keys(t.PROJECTION)[0]:t.PROJECTION;return"no_uoff"in t||"no_off"in t||-1!==["Hotine_Oblique_Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin"].indexOf(e)}(this),this.no_rot="no_rot"in this;var g=!1;"alpha"in this&&(g=!0);var v=!1;if("rectified_grid_angle"in this&&(v=!0),g&&(y=this.alpha),v&&(u=this.rectified_grid_angle*de),g||v)d=this.longc;else if(p=this.long1,f=this.lat1,m=this.long2,_=this.lat2,Math.abs(f-_)<=rs||(t=Math.abs(f))<=rs||Math.abs(t-ce)<=rs||Math.abs(Math.abs(this.lat0)-ce)<=rs||Math.abs(Math.abs(_)-ce)<=rs)throw new Error;var M=1-this.es;e=Math.sqrt(M),Math.abs(this.lat0)>ue?(o=Math.sin(this.lat0),i=Math.cos(this.lat0),t=1-this.es*o*o,this.B=i*i,this.B=Math.sqrt(1+this.es*this.B*this.B/M),this.A=this.B*this.k0*e/t,(r=(s=this.B*e/(i*Math.sqrt(t)))*s-1)<=0?r=0:(r=Math.sqrt(r),this.lat0<0&&(r=-r)),this.E=r+=s,this.E*=Math.pow(Fe(this.e,this.lat0,o),this.B)):(this.B=1/e,this.A=this.k0,this.E=s=r=1),g||v?(g?(c=Math.asin(Math.sin(y)/s),!v&&(u=y)):(c=u,y=Math.asin(s*Math.sin(c))),this.lam0=d-Math.asin(.5*(r-1/r)*Math.tan(c))/this.B):(a=Math.pow(Fe(this.e,f,Math.sin(f)),this.B),n=Math.pow(Fe(this.e,_,Math.sin(_)),this.B),r=this.E/a,l=(n-a)/(n+a),h=((h=this.E*this.E)-n*a)/(h+n*a),(t=p-m)<-Math.pi?m-=fe:t>Math.pi&&(m+=fe),this.lam0=je(.5*(p+m)-Math.atan(h*Math.tan(.5*this.B*(p-m))/l)/this.B),c=Math.atan(2*Math.sin(this.B*je(p-this.lam0))/(r-1/r)),u=y=Math.asin(s*Math.sin(c))),this.singam=Math.sin(c),this.cosgam=Math.cos(c),this.sinrot=Math.sin(u),this.cosrot=Math.cos(u),this.rB=1/this.B,this.ArB=this.A*this.rB,this.BrA=1/this.ArB,this.A,this.B,this.no_off?this.u_0=0:(this.u_0=Math.abs(this.ArB*Math.atan(Math.sqrt(s*s-1)/Math.cos(y))),this.lat0<0&&(this.u_0=-this.u_0)),r=.5*c,this.v_pole_n=this.ArB*Math.log(Math.tan(me-r)),this.v_pole_s=this.ArB*Math.log(Math.tan(me+r))},forward:function(t){var e,i,s,r,a,n,o,l,h={};if(t.x=t.x-this.lam0,Math.abs(Math.abs(t.y)-ce)>ue){if(e=.5*((a=this.E/Math.pow(Fe(this.e,t.y,Math.sin(t.y)),this.B))-(n=1/a)),i=.5*(a+n),r=Math.sin(this.B*t.x),s=(e*this.singam-r*this.cosgam)/i,Math.abs(Math.abs(s)-1)<ue)throw new Error;l=.5*this.ArB*Math.log((1-s)/(1+s)),n=Math.cos(this.B*t.x),o=Math.abs(n)<rs?this.A*t.x:this.ArB*Math.atan2(e*this.cosgam+r*this.singam,n)}else l=t.y>0?this.v_pole_n:this.v_pole_s,o=this.ArB*t.y;return this.no_rot?(h.x=o,h.y=l):(o-=this.u_0,h.x=l*this.cosrot+o*this.sinrot,h.y=o*this.cosrot-l*this.sinrot),h.x=this.a*h.x+this.x0,h.y=this.a*h.y+this.y0,h},inverse:function(t){var e,i,s,r,a,n,o,l={};if(t.x=(t.x-this.x0)*(1/this.a),t.y=(t.y-this.y0)*(1/this.a),this.no_rot?(i=t.y,e=t.x):(i=t.x*this.cosrot-t.y*this.sinrot,e=t.y*this.cosrot+t.x*this.sinrot+this.u_0),r=.5*((s=Math.exp(-this.BrA*i))-1/s),a=.5*(s+1/s),o=((n=Math.sin(this.BrA*e))*this.cosgam+r*this.singam)/a,Math.abs(Math.abs(o)-1)<ue)l.x=0,l.y=o<0?-ce:ce;else{if(l.y=this.E/Math.sqrt((1+o)/(1-o)),l.y=We(this.e,Math.pow(l.y,1/this.B)),l.y===1/0)throw new Error;l.x=-this.rB*Math.atan2(r*this.cosgam-n*this.singam,Math.cos(this.BrA*e))}return l.x+=this.lam0,l},names:["Hotine_Oblique_Mercator","Hotine Oblique Mercator","Hotine_Oblique_Mercator_Azimuth_Natural_Origin","Hotine_Oblique_Mercator_Two_Point_Natural_Origin","Hotine_Oblique_Mercator_Azimuth_Center","Oblique_Mercator","omerc"]};const ns={init:function(){if(!this.lat2&&(this.lat2=this.lat1),!this.k0&&(this.k0=1),this.x0=this.x0||0,this.y0=this.y0||0,!(Math.abs(this.lat1+this.lat2)<ue)){var t=this.b/this.a;this.e=Math.sqrt(1-t*t);var e=Math.sin(this.lat1),i=Math.cos(this.lat1),s=Ge(this.e,e,i),r=Fe(this.e,this.lat1,e),a=Math.sin(this.lat2),n=Math.cos(this.lat2),o=Ge(this.e,a,n),l=Fe(this.e,this.lat2,a),h=Fe(this.e,this.lat0,Math.sin(this.lat0));Math.abs(this.lat1-this.lat2)>ue?this.ns=Math.log(s/o)/Math.log(r/l):this.ns=e,isNaN(this.ns)&&(this.ns=e),this.f0=s/(this.ns*Math.pow(r,this.ns)),this.rh=this.a*this.f0*Math.pow(h,this.ns),!this.title&&(this.title="Lambert Conformal Conic")}},forward:function(t){var e=t.x,i=t.y;Math.abs(2*Math.abs(i)-Math.PI)<=ue&&(i=Ve(i)*(ce-2e-10));var s,r,a=Math.abs(Math.abs(i)-ce);if(a>ue)s=Fe(this.e,i,Math.sin(i)),r=this.a*this.f0*Math.pow(s,this.ns);else{if((a=i*this.ns)<=0)return null;r=0}var n=this.ns*je(e-this.long0);return t.x=this.k0*(r*Math.sin(n))+this.x0,t.y=this.k0*(this.rh-r*Math.cos(n))+this.y0,t},inverse:function(t){var e,i,s,r,a,n=(t.x-this.x0)/this.k0,o=this.rh-(t.y-this.y0)/this.k0;this.ns>0?(e=Math.sqrt(n*n+o*o),i=1):(e=-Math.sqrt(n*n+o*o),i=-1);var l=0;if(0!==e&&(l=Math.atan2(i*n,i*o)),0!==e||this.ns>0){if(i=1/this.ns,s=Math.pow(e/(this.a*this.f0),i),-9999===(r=We(this.e,s)))return null}else r=-ce;return a=je(l/this.ns+this.long0),t.x=a,t.y=r,t},names:["Lambert Tangential Conformal Conic Projection","Lambert_Conformal_Conic","Lambert_Conformal_Conic_1SP","Lambert_Conformal_Conic_2SP","lcc","Lambert Conic Conformal (1SP)","Lambert Conic Conformal (2SP)"]};const os={init:function(){this.a=6377397.155,this.es=.006674372230614,this.e=Math.sqrt(this.es),!this.lat0&&(this.lat0=.863937979737193),!this.long0&&(this.long0=.4334234309119251),!this.k0&&(this.k0=.9999),this.s45=.785398163397448,this.s90=2*this.s45,this.fi0=this.lat0,this.e2=this.es,this.e=Math.sqrt(this.e2),this.alfa=Math.sqrt(1+this.e2*Math.pow(Math.cos(this.fi0),4)/(1-this.e2)),this.uq=1.04216856380474,this.u0=Math.asin(Math.sin(this.fi0)/this.alfa),this.g=Math.pow((1+this.e*Math.sin(this.fi0))/(1-this.e*Math.sin(this.fi0)),this.alfa*this.e/2),this.k=Math.tan(this.u0/2+this.s45)/Math.pow(Math.tan(this.fi0/2+this.s45),this.alfa)*this.g,this.k1=this.k0,this.n0=this.a*Math.sqrt(1-this.e2)/(1-this.e2*Math.pow(Math.sin(this.fi0),2)),this.s0=1.37008346281555,this.n=Math.sin(this.s0),this.ro0=this.k1*this.n0/Math.tan(this.s0),this.ad=this.s90-this.uq},forward:function(t){var e,i,s,r,a,n,o,l=t.x,h=t.y,c=je(l-this.long0);return e=Math.pow((1+this.e*Math.sin(h))/(1-this.e*Math.sin(h)),this.alfa*this.e/2),i=2*(Math.atan(this.k*Math.pow(Math.tan(h/2+this.s45),this.alfa)/e)-this.s45),s=-c*this.alfa,r=Math.asin(Math.cos(this.ad)*Math.sin(i)+Math.sin(this.ad)*Math.cos(i)*Math.cos(s)),a=Math.asin(Math.cos(i)*Math.sin(s)/Math.cos(r)),n=this.n*a,o=this.ro0*Math.pow(Math.tan(this.s0/2+this.s45),this.n)/Math.pow(Math.tan(r/2+this.s45),this.n),t.y=o*Math.cos(n)/1,t.x=o*Math.sin(n)/1,!this.czech&&(t.y*=-1,t.x*=-1),t},inverse:function(t){var e,i,s,r,a,n,o,l=t.x;t.x=t.y,t.y=l,!this.czech&&(t.y*=-1,t.x*=-1),a=Math.sqrt(t.x*t.x+t.y*t.y),r=Math.atan2(t.y,t.x)/Math.sin(this.s0),s=2*(Math.atan(Math.pow(this.ro0/a,1/this.n)*Math.tan(this.s0/2+this.s45))-this.s45),e=Math.asin(Math.cos(this.ad)*Math.sin(s)-Math.sin(this.ad)*Math.cos(s)*Math.cos(r)),i=Math.asin(Math.cos(s)*Math.sin(r)/Math.cos(e)),t.x=this.long0-i/this.alfa,n=e,o=0;var h=0;do{t.y=2*(Math.atan(Math.pow(this.k,-1/this.alfa)*Math.pow(Math.tan(e/2+this.s45),1/this.alfa)*Math.pow((1+this.e*Math.sin(n))/(1-this.e*Math.sin(n)),this.e/2))-this.s45),Math.abs(n-t.y)<1e-10&&(o=1),n=t.y,h+=1}while(0===o&&h<15);return h>=15?null:t},names:["Krovak","krovak"]};function ls(t,e,i,s,r){return t*r-e*Math.sin(2*r)+i*Math.sin(4*r)-s*Math.sin(6*r)}function hs(t){return 1-.25*t*(1+t/16*(3+1.25*t))}function cs(t){return.375*t*(1+.25*t*(1+.46875*t))}function us(t){return.05859375*t*t*(1+.75*t)}function ds(t){return t*t*t*(35/3072)}function ps(t,e,i){var s=e*i;return t/Math.sqrt(1-s*s)}function ms(t){return Math.abs(t)<ce?t:t-Ve(t)*Math.PI}function fs(t,e,i,s,r){var a,n;a=t/e;for(var o=0;o<15;o++)if(a+=n=(t-(e*a-i*Math.sin(2*a)+s*Math.sin(4*a)-r*Math.sin(6*a)))/(e-2*i*Math.cos(2*a)+4*s*Math.cos(4*a)-6*r*Math.cos(6*a)),Math.abs(n)<=1e-10)return a;return NaN}const _s={init:function(){!this.sphere&&(this.e0=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ds(this.es),this.ml0=this.a*ls(this.e0,this.e1,this.e2,this.e3,this.lat0))},forward:function(t){var e,i,s=t.x,r=t.y;if(s=je(s-this.long0),this.sphere)e=this.a*Math.asin(Math.cos(r)*Math.sin(s)),i=this.a*(Math.atan2(Math.tan(r),Math.cos(s))-this.lat0);else{var a=Math.sin(r),n=Math.cos(r),o=ps(this.a,this.e,a),l=Math.tan(r)*Math.tan(r),h=s*Math.cos(r),c=h*h,u=this.es*n*n/(1-this.es);e=o*h*(1-c*l*(1/6-(8-l+8*u)*c/120)),i=this.a*ls(this.e0,this.e1,this.e2,this.e3,r)-this.ml0+o*a/n*c*(.5+(5-l+6*u)*c/24)}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,s=t.x/this.a,r=t.y/this.a;if(this.sphere){var a=r+this.lat0;e=Math.asin(Math.sin(a)*Math.cos(s)),i=Math.atan2(Math.tan(s),Math.cos(a))}else{var n=fs(this.ml0/this.a+r,this.e0,this.e1,this.e2,this.e3);if(Math.abs(Math.abs(n)-ce)<=ue)return t.x=this.long0,t.y=ce,r<0&&(t.y*=-1),t;var o=ps(this.a,this.e,Math.sin(n)),l=o*o*o/this.a/this.a*(1-this.es),h=Math.pow(Math.tan(n),2),c=s*this.a/o,u=c*c;e=n-o*Math.tan(n)/l*c*c*(.5-(1+3*h)*c*c/24),i=c*(1-u*(h/3+(1+3*h)*h*u/15))/Math.cos(n)}return t.x=je(i+this.long0),t.y=ms(e),t},names:["Cassini","Cassini_Soldner","cass"]};function ys(t,e){var i;return t>1e-7?(1-t*t)*(e/(1-(i=t*e)*i)-.5/t*Math.log((1-i)/(1+i))):2*e}var gs=.3333333333333333,vs=.17222222222222222,Ms=.10257936507936508,Cs=.06388888888888888,xs=.0664021164021164,bs=.016415012942191543;const ws={init:function(){var t,e=Math.abs(this.lat0);if(Math.abs(e-ce)<ue?this.mode=this.lat0<0?this.S_POLE:this.N_POLE:Math.abs(e)<ue?this.mode=this.EQUIT:this.mode=this.OBLIQ,this.es>0)switch(this.qp=ys(this.e,1),this.mmf=.5/(1-this.es),this.apa=function(t){var e,i=[];return i[0]=t*gs,e=t*t,i[0]+=e*vs,i[1]=e*Cs,e*=t,i[0]+=e*Ms,i[1]+=e*xs,i[2]=e*bs,i}(this.es),this.mode){case this.N_POLE:case this.S_POLE:this.dd=1;break;case this.EQUIT:this.rq=Math.sqrt(.5*this.qp),this.dd=1/this.rq,this.xmf=1,this.ymf=.5*this.qp;break;case this.OBLIQ:this.rq=Math.sqrt(.5*this.qp),t=Math.sin(this.lat0),this.sinb1=ys(this.e,t)/this.qp,this.cosb1=Math.sqrt(1-this.sinb1*this.sinb1),this.dd=Math.cos(this.lat0)/(Math.sqrt(1-this.es*t*t)*this.rq*this.cosb1),this.ymf=(this.xmf=this.rq)/this.dd,this.xmf*=this.dd}else this.mode===this.OBLIQ&&(this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0))},forward:function(t){var e,i,s,r,a,n,o,l,h,c,u=t.x,d=t.y;if(u=je(u-this.long0),this.sphere){if(a=Math.sin(d),c=Math.cos(d),s=Math.cos(u),this.mode===this.OBLIQ||this.mode===this.EQUIT){if((i=this.mode===this.EQUIT?1+c*s:1+this.sinph0*a+this.cosph0*c*s)<=ue)return null;e=(i=Math.sqrt(2/i))*c*Math.sin(u),i*=this.mode===this.EQUIT?a:this.cosph0*a-this.sinph0*c*s}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(s=-s),Math.abs(d+this.lat0)<ue)return null;i=me-.5*d,e=(i=2*(this.mode===this.S_POLE?Math.cos(i):Math.sin(i)))*Math.sin(u),i*=s}}else{switch(o=0,l=0,h=0,s=Math.cos(u),r=Math.sin(u),a=Math.sin(d),n=ys(this.e,a),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(o=n/this.qp,l=Math.sqrt(1-o*o)),this.mode){case this.OBLIQ:h=1+this.sinb1*o+this.cosb1*l*s;break;case this.EQUIT:h=1+l*s;break;case this.N_POLE:h=ce+d,n=this.qp-n;break;case this.S_POLE:h=d-ce,n=this.qp+n}if(Math.abs(h)<ue)return null;switch(this.mode){case this.OBLIQ:case this.EQUIT:h=Math.sqrt(2/h),i=this.mode===this.OBLIQ?this.ymf*h*(this.cosb1*o-this.sinb1*l*s):(h=Math.sqrt(2/(1+l*s)))*o*this.ymf,e=this.xmf*h*l*r;break;case this.N_POLE:case this.S_POLE:n>=0?(e=(h=Math.sqrt(n))*r,i=s*(this.mode===this.S_POLE?h:-h)):e=i=0}}return t.x=this.a*e+this.x0,t.y=this.a*i+this.y0,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e,i,s,r,a,n,o,l=t.x/this.a,h=t.y/this.a;if(this.sphere){var c,u=0,d=0;if((i=.5*(c=Math.sqrt(l*l+h*h)))>1)return null;switch(i=2*Math.asin(i),(this.mode===this.OBLIQ||this.mode===this.EQUIT)&&(d=Math.sin(i),u=Math.cos(i)),this.mode){case this.EQUIT:i=Math.abs(c)<=ue?0:Math.asin(h*d/c),l*=d,h=u*c;break;case this.OBLIQ:i=Math.abs(c)<=ue?this.lat0:Math.asin(u*this.sinph0+h*d*this.cosph0/c),l*=d*this.cosph0,h=(u-Math.sin(i)*this.sinph0)*c;break;case this.N_POLE:h=-h,i=ce-i;break;case this.S_POLE:i-=ce}e=0!==h||this.mode!==this.EQUIT&&this.mode!==this.OBLIQ?Math.atan2(l,h):0}else{if(o=0,this.mode===this.OBLIQ||this.mode===this.EQUIT){if(l/=this.dd,h*=this.dd,(n=Math.sqrt(l*l+h*h))<ue)return t.x=this.long0,t.y=this.lat0,t;r=2*Math.asin(.5*n/this.rq),s=Math.cos(r),l*=r=Math.sin(r),this.mode===this.OBLIQ?(o=s*this.sinb1+h*r*this.cosb1/n,a=this.qp*o,h=n*this.cosb1*s-h*this.sinb1*r):(o=h*r/n,a=this.qp*o,h=n*s)}else if(this.mode===this.N_POLE||this.mode===this.S_POLE){if(this.mode===this.N_POLE&&(h=-h),!(a=l*l+h*h))return t.x=this.long0,t.y=this.lat0,t;o=1-a/this.qp,this.mode===this.S_POLE&&(o=-o)}e=Math.atan2(l,h),i=function(t,e){var i=t+t;return t+e[0]*Math.sin(i)+e[1]*Math.sin(i+i)+e[2]*Math.sin(i+i+i)}(Math.asin(o),this.apa)}return t.x=je(this.long0+e),t.y=i,t},names:["Lambert Azimuthal Equal Area","Lambert_Azimuthal_Equal_Area","laea"],S_POLE:1,N_POLE:2,EQUIT:3,OBLIQ:4};function Ps(t){return Math.abs(t)>1&&(t=t>1?1:-1),Math.asin(t)}const Ss={init:function(){Math.abs(this.lat1+this.lat2)<ue||(this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e3=Math.sqrt(this.es),this.sin_po=Math.sin(this.lat1),this.cos_po=Math.cos(this.lat1),this.t1=this.sin_po,this.con=this.sin_po,this.ms1=Ge(this.e3,this.sin_po,this.cos_po),this.qs1=ys(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat2),this.cos_po=Math.cos(this.lat2),this.t2=this.sin_po,this.ms2=Ge(this.e3,this.sin_po,this.cos_po),this.qs2=ys(this.e3,this.sin_po),this.sin_po=Math.sin(this.lat0),this.cos_po=Math.cos(this.lat0),this.t3=this.sin_po,this.qs0=ys(this.e3,this.sin_po),Math.abs(this.lat1-this.lat2)>ue?this.ns0=(this.ms1*this.ms1-this.ms2*this.ms2)/(this.qs2-this.qs1):this.ns0=this.con,this.c=this.ms1*this.ms1+this.ns0*this.qs1,this.rh=this.a*Math.sqrt(this.c-this.ns0*this.qs0)/this.ns0)},forward:function(t){var e=t.x,i=t.y;this.sin_phi=Math.sin(i),this.cos_phi=Math.cos(i);var s=ys(this.e3,this.sin_phi),r=this.a*Math.sqrt(this.c-this.ns0*s)/this.ns0,a=this.ns0*je(e-this.long0),n=r*Math.sin(a)+this.x0,o=this.rh-r*Math.cos(a)+this.y0;return t.x=n,t.y=o,t},inverse:function(t){var e,i,s,r,a,n;return t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns0>=0?(e=Math.sqrt(t.x*t.x+t.y*t.y),s=1):(e=-Math.sqrt(t.x*t.x+t.y*t.y),s=-1),r=0,0!==e&&(r=Math.atan2(s*t.x,s*t.y)),s=e*this.ns0/this.a,this.sphere?n=Math.asin((this.c-s*s)/(2*this.ns0)):(i=(this.c-s*s)/this.ns0,n=this.phi1z(this.e3,i)),a=je(r/this.ns0+this.long0),t.x=a,t.y=n,t},names:["Albers_Conic_Equal_Area","Albers","aea"],phi1z:function(t,e){var i,s,r,a,n=Ps(.5*e);if(t<ue)return n;for(var o=t*t,l=1;l<=25;l++)if(n+=a=.5*(r=1-(s=t*(i=Math.sin(n)))*s)*r/Math.cos(n)*(e/(1-o)-i/r+.5/t*Math.log((1-s)/(1+s))),Math.abs(a)<=1e-7)return n;return null}};const Ts={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0),this.infinity_dist=1e3*this.a,this.rc=1},forward:function(t){var e,i,s,r,a,n,o,l=t.x,h=t.y;return s=je(l-this.long0),e=Math.sin(h),i=Math.cos(h),r=Math.cos(s),(a=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(a)<=ue?(n=this.x0+1*this.a*i*Math.sin(s)/a,o=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)/a):(n=this.x0+this.infinity_dist*i*Math.sin(s),o=this.y0+this.infinity_dist*(this.cos_p14*e-this.sin_p14*i*r)),t.x=n,t.y=o,t},inverse:function(t){var e,i,s,r,a,n;return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,t.x/=this.k0,t.y/=this.k0,(e=Math.sqrt(t.x*t.x+t.y*t.y))?(r=Math.atan2(e,this.rc),i=Math.sin(r),n=Ps((s=Math.cos(r))*this.sin_p14+t.y*i*this.cos_p14/e),a=Math.atan2(t.x*i,e*this.cos_p14*s-t.y*this.sin_p14*i),a=je(this.long0+a)):(n=this.phic0,a=0),t.x=a,t.y=n,t},names:["gnom"]};const Es={init:function(){!this.sphere&&(this.k0=Ge(this.e,Math.sin(this.lat_ts),Math.cos(this.lat_ts)))},forward:function(t){var e,i,s=t.x,r=t.y,a=je(s-this.long0);if(this.sphere)e=this.x0+this.a*a*Math.cos(this.lat_ts),i=this.y0+this.a*Math.sin(r)/Math.cos(this.lat_ts);else{var n=ys(this.e,Math.sin(r));e=this.x0+this.a*this.k0*a,i=this.y0+this.a*n*.5/this.k0}return t.x=e,t.y=i,t},inverse:function(t){var e,i;return t.x-=this.x0,t.y-=this.y0,this.sphere?(e=je(this.long0+t.x/this.a/Math.cos(this.lat_ts)),i=Math.asin(t.y/this.a*Math.cos(this.lat_ts))):(i=function(t,e){var i=1-(1-t*t)/(2*t)*Math.log((1-t)/(1+t));if(Math.abs(Math.abs(e)-i)<1e-6)return e<0?-1*ce:ce;for(var s,r,a,n,o=Math.asin(.5*e),l=0;l<30;l++)if(r=Math.sin(o),a=Math.cos(o),n=t*r,o+=s=Math.pow(1-n*n,2)/(2*a)*(e/(1-t*t)-r/(1-n*n)+.5/t*Math.log((1-n)/(1+n))),Math.abs(s)<=1e-10)return o;return NaN}(this.e,2*t.y*this.k0/this.a),e=je(this.long0+t.x/(this.a*this.k0))),t.x=e,t.y=i,t},names:["cea"]};const ks={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Equidistant Cylindrical (Plate Carre)",this.rc=Math.cos(this.lat_ts)},forward:function(t){var e=t.x,i=t.y,s=je(e-this.long0),r=ms(i-this.lat0);return t.x=this.x0+this.a*s*this.rc,t.y=this.y0+this.a*r,t},inverse:function(t){var e=t.x,i=t.y;return t.x=je(this.long0+(e-this.x0)/(this.a*this.rc)),t.y=ms(this.lat0+(i-this.y0)/this.a),t},names:["Equirectangular","Equidistant_Cylindrical","eqc"]};const Is={init:function(){this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ds(this.es),this.ml0=this.a*ls(this.e0,this.e1,this.e2,this.e3,this.lat0)},forward:function(t){var e,i,s,r=t.x,a=t.y,n=je(r-this.long0);if(s=n*Math.sin(a),this.sphere)Math.abs(a)<=ue?(e=this.a*n,i=-1*this.a*this.lat0):(e=this.a*Math.sin(s)/Math.tan(a),i=this.a*(ms(a-this.lat0)+(1-Math.cos(s))/Math.tan(a)));else if(Math.abs(a)<=ue)e=this.a*n,i=-1*this.ml0;else{var o=ps(this.a,this.e,Math.sin(a))/Math.tan(a);e=o*Math.sin(s),i=this.a*ls(this.e0,this.e1,this.e2,this.e3,a)-this.ml0+o*(1-Math.cos(s))}return t.x=e+this.x0,t.y=i+this.y0,t},inverse:function(t){var e,i,s,r,a,n,o,l,h;if(s=t.x-this.x0,r=t.y-this.y0,this.sphere)if(Math.abs(r+this.a*this.lat0)<=ue)e=je(s/this.a+this.long0),i=0;else{var c;for(n=this.lat0+r/this.a,o=s*s/this.a/this.a+n*n,l=n,a=20;a;--a)if(l+=h=-1*(n*(l*(c=Math.tan(l))+1)-l-.5*(l*l+o)*c)/((l-n)/c-1),Math.abs(h)<=ue){i=l;break}e=je(this.long0+Math.asin(s*Math.tan(l)/this.a)/Math.sin(i))}else if(Math.abs(r+this.ml0)<=ue)i=0,e=je(this.long0+s/this.a);else{var u,d,p,m,f;for(n=(this.ml0+r)/this.a,o=s*s/this.a/this.a+n*n,l=n,a=20;a;--a)if(f=this.e*Math.sin(l),u=Math.sqrt(1-f*f)*Math.tan(l),d=this.a*ls(this.e0,this.e1,this.e2,this.e3,l),p=this.e0-2*this.e1*Math.cos(2*l)+4*this.e2*Math.cos(4*l)-6*this.e3*Math.cos(6*l),l-=h=(n*(u*(m=d/this.a)+1)-m-.5*u*(m*m+o))/(this.es*Math.sin(2*l)*(m*m+o-2*n*m)/(4*u)+(n-m)*(u*p-2/Math.sin(2*l))-p),Math.abs(h)<=ue){i=l;break}u=Math.sqrt(1-this.es*Math.pow(Math.sin(i),2))*Math.tan(i),e=je(this.long0+Math.asin(s*u/this.a)/Math.sin(i))}return t.x=e,t.y=i,t},names:["Polyconic","poly"]};const Ls={init:function(){this.A=[],this.A[1]=.6399175073,this.A[2]=-.1358797613,this.A[3]=.063294409,this.A[4]=-.02526853,this.A[5]=.0117879,this.A[6]=-.0055161,this.A[7]=.0026906,this.A[8]=-.001333,this.A[9]=67e-5,this.A[10]=-34e-5,this.B_re=[],this.B_im=[],this.B_re[1]=.7557853228,this.B_im[1]=0,this.B_re[2]=.249204646,this.B_im[2]=.003371507,this.B_re[3]=-.001541739,this.B_im[3]=.04105856,this.B_re[4]=-.10162907,this.B_im[4]=.01727609,this.B_re[5]=-.26623489,this.B_im[5]=-.36249218,this.B_re[6]=-.6870983,this.B_im[6]=-1.1651967,this.C_re=[],this.C_im=[],this.C_re[1]=1.3231270439,this.C_im[1]=0,this.C_re[2]=-.577245789,this.C_im[2]=-.007809598,this.C_re[3]=.508307513,this.C_im[3]=-.112208952,this.C_re[4]=-.15094762,this.C_im[4]=.18200602,this.C_re[5]=1.01418179,this.C_im[5]=1.64497696,this.C_re[6]=1.9660549,this.C_im[6]=2.5127645,this.D=[],this.D[1]=1.5627014243,this.D[2]=.5185406398,this.D[3]=-.03333098,this.D[4]=-.1052906,this.D[5]=-.0368594,this.D[6]=.007317,this.D[7]=.0122,this.D[8]=.00394,this.D[9]=-.0013},forward:function(t){var e,i=t.x,s=t.y-this.lat0,r=i-this.long0,a=s/he*1e-5,n=r,o=1,l=0;for(e=1;e<=10;e++)o*=a,l+=this.A[e]*o;var h,c=l,u=n,d=1,p=0,m=0,f=0;for(e=1;e<=6;e++)h=p*c+d*u,d=d*c-p*u,p=h,m=m+this.B_re[e]*d-this.B_im[e]*p,f=f+this.B_im[e]*d+this.B_re[e]*p;return t.x=f*this.a+this.x0,t.y=m*this.a+this.y0,t},inverse:function(t){var e,i,s=t.x,r=t.y,a=s-this.x0,n=(r-this.y0)/this.a,o=a/this.a,l=1,h=0,c=0,u=0;for(e=1;e<=6;e++)i=h*n+l*o,l=l*n-h*o,h=i,c=c+this.C_re[e]*l-this.C_im[e]*h,u=u+this.C_im[e]*l+this.C_re[e]*h;for(var d=0;d<this.iterations;d++){var p,m=c,f=u,_=n,y=o;for(e=2;e<=6;e++)p=f*c+m*u,m=m*c-f*u,f=p,_+=(e-1)*(this.B_re[e]*m-this.B_im[e]*f),y+=(e-1)*(this.B_im[e]*m+this.B_re[e]*f);m=1,f=0;var g=this.B_re[1],v=this.B_im[1];for(e=2;e<=6;e++)p=f*c+m*u,m=m*c-f*u,f=p,g+=e*(this.B_re[e]*m-this.B_im[e]*f),v+=e*(this.B_im[e]*m+this.B_re[e]*f);var M=g*g+v*v;c=(_*g+y*v)/M,u=(y*g-_*v)/M}var C=c,x=u,b=1,w=0;for(e=1;e<=9;e++)b*=C,w+=this.D[e]*b;var P=this.lat0+w*he*1e5,S=this.long0+x;return t.x=S,t.y=P,t},names:["New_Zealand_Map_Grid","nzmg"]};const As={init:function(){},forward:function(t){var e=t.x,i=t.y,s=je(e-this.long0),r=this.x0+this.a*s,a=this.y0+this.a*Math.log(Math.tan(Math.PI/4+i/2.5))*1.25;return t.x=r,t.y=a,t},inverse:function(t){t.x-=this.x0,t.y-=this.y0;var e=je(this.long0+t.x/this.a),i=2.5*(Math.atan(Math.exp(.8*t.y/this.a))-Math.PI/4);return t.x=e,t.y=i,t},names:["Miller_Cylindrical","mill"]};const Os={init:function(){this.sphere?(this.n=1,this.m=0,this.es=0,this.C_y=Math.sqrt((this.m+1)/this.n),this.C_x=this.C_y/(this.m+1)):this.en=Wi(this.es)},forward:function(t){var e,i,s=t.x,r=t.y;if(s=je(s-this.long0),this.sphere){if(this.m)for(var a=this.n*Math.sin(r),n=20;n;--n){var o=(this.m*r+Math.sin(r)-a)/(this.m+Math.cos(r));if(r-=o,Math.abs(o)<ue)break}else r=1!==this.n?Math.asin(this.n*Math.sin(r)):r;e=this.a*this.C_x*s*(this.m+Math.cos(r)),i=this.a*this.C_y*r}else{var l=Math.sin(r),h=Math.cos(r);i=this.a*qi(r,l,h,this.en),e=this.a*s*h/Math.sqrt(1-this.es*l*l)}return t.x=e,t.y=i,t},inverse:function(t){var e,i,s;return t.x-=this.x0,i=t.x/this.a,t.y-=this.y0,e=t.y/this.a,this.sphere?(e/=this.C_y,i/=this.C_x*(this.m+Math.cos(e)),this.m?e=Ps((this.m*e+Math.sin(e))/this.n):1!==this.n&&(e=Ps(Math.sin(e)/this.n)),i=je(i+this.long0),e=ms(e)):(e=Bi(t.y/this.a,this.es,this.en),(s=Math.abs(e))<ce?(s=Math.sin(e),i=je(this.long0+t.x*Math.sqrt(1-this.es*s*s)/(this.a*Math.cos(e)))):s-ue<ce&&(i=this.long0)),t.x=i,t.y=e,t},names:["Sinusoidal","sinu"]};const zs={init:function(){},forward:function(t){for(var e=t.x,i=t.y,s=je(e-this.long0),r=i,a=Math.PI*Math.sin(i);;){var n=-(r+Math.sin(r)-a)/(1+Math.cos(r));if(r+=n,Math.abs(n)<ue)break}r/=2,Math.PI/2-Math.abs(i)<ue&&(s=0);var o=.900316316158*this.a*s*Math.cos(r)+this.x0,l=1.4142135623731*this.a*Math.sin(r)+this.y0;return t.x=o,t.y=l,t},inverse:function(t){var e,i;t.x-=this.x0,t.y-=this.y0,i=t.y/(1.4142135623731*this.a),Math.abs(i)>.999999999999&&(i=.999999999999),e=Math.asin(i);var s=je(this.long0+t.x/(.900316316158*this.a*Math.cos(e)));s<-Math.PI&&(s=-Math.PI),s>Math.PI&&(s=Math.PI),i=(2*e+Math.sin(2*e))/Math.PI,Math.abs(i)>1&&(i=1);var r=Math.asin(i);return t.x=s,t.y=r,t},names:["Mollweide","moll"]};const Rs={init:function(){Math.abs(this.lat1+this.lat2)<ue||(this.lat2=this.lat2||this.lat1,this.temp=this.b/this.a,this.es=1-Math.pow(this.temp,2),this.e=Math.sqrt(this.es),this.e0=hs(this.es),this.e1=cs(this.es),this.e2=us(this.es),this.e3=ds(this.es),this.sinphi=Math.sin(this.lat1),this.cosphi=Math.cos(this.lat1),this.ms1=Ge(this.e,this.sinphi,this.cosphi),this.ml1=ls(this.e0,this.e1,this.e2,this.e3,this.lat1),Math.abs(this.lat1-this.lat2)<ue?this.ns=this.sinphi:(this.sinphi=Math.sin(this.lat2),this.cosphi=Math.cos(this.lat2),this.ms2=Ge(this.e,this.sinphi,this.cosphi),this.ml2=ls(this.e0,this.e1,this.e2,this.e3,this.lat2),this.ns=(this.ms1-this.ms2)/(this.ml2-this.ml1)),this.g=this.ml1+this.ms1/this.ns,this.ml0=ls(this.e0,this.e1,this.e2,this.e3,this.lat0),this.rh=this.a*(this.g-this.ml0))},forward:function(t){var e,i=t.x,s=t.y;if(this.sphere)e=this.a*(this.g-s);else{var r=ls(this.e0,this.e1,this.e2,this.e3,s);e=this.a*(this.g-r)}var a=this.ns*je(i-this.long0),n=this.x0+e*Math.sin(a),o=this.y0+this.rh-e*Math.cos(a);return t.x=n,t.y=o,t},inverse:function(t){var e,i,s,r;t.x-=this.x0,t.y=this.rh-t.y+this.y0,this.ns>=0?(i=Math.sqrt(t.x*t.x+t.y*t.y),e=1):(i=-Math.sqrt(t.x*t.x+t.y*t.y),e=-1);var a=0;return 0!==i&&(a=Math.atan2(e*t.x,e*t.y)),this.sphere?(r=je(this.long0+a/this.ns),s=ms(this.g-i/this.a),t.x=r,t.y=s,t):(s=fs(this.g-i/this.a,this.e0,this.e1,this.e2,this.e3),r=je(this.long0+a/this.ns),t.x=r,t.y=s,t)},names:["Equidistant_Conic","eqdc"]};const Ds={init:function(){this.R=this.a},forward:function(t){var e,i,s=t.x,r=t.y,a=je(s-this.long0);Math.abs(r)<=ue&&(e=this.x0+this.R*a,i=this.y0);var n=Ps(2*Math.abs(r/Math.PI));(Math.abs(a)<=ue||Math.abs(Math.abs(r)-ce)<=ue)&&(e=this.x0,i=r>=0?this.y0+Math.PI*this.R*Math.tan(.5*n):this.y0+Math.PI*this.R*-Math.tan(.5*n));var o=.5*Math.abs(Math.PI/a-a/Math.PI),l=o*o,h=Math.sin(n),c=Math.cos(n),u=c/(h+c-1),d=u*u,p=u*(2/h-1),m=p*p,f=Math.PI*this.R*(o*(u-m)+Math.sqrt(l*(u-m)*(u-m)-(m+l)*(d-m)))/(m+l);a<0&&(f=-f),e=this.x0+f;var _=l+u;return f=Math.PI*this.R*(p*_-o*Math.sqrt((m+l)*(l+1)-_*_))/(m+l),i=r>=0?this.y0+f:this.y0-f,t.x=e,t.y=i,t},inverse:function(t){var e,i,s,r,a,n,o,l,h,c,u,d;return t.x-=this.x0,t.y-=this.y0,u=Math.PI*this.R,a=(s=t.x/u)*s+(r=t.y/u)*r,u=3*(r*r/(l=-2*(n=-Math.abs(r)*(1+a))+1+2*r*r+a*a)+(2*(o=n-2*r*r+s*s)*o*o/l/l/l-9*n*o/l/l)/27)/(h=(n-o*o/3/l)/l)/(c=2*Math.sqrt(-h/3)),Math.abs(u)>1&&(u=u>=0?1:-1),d=Math.acos(u)/3,i=t.y>=0?(-c*Math.cos(d+Math.PI/3)-o/3/l)*Math.PI:-(-c*Math.cos(d+Math.PI/3)-o/3/l)*Math.PI,e=Math.abs(s)<ue?this.long0:je(this.long0+Math.PI*(a-1+Math.sqrt(1+2*(s*s-r*r)+a*a))/2/s),t.x=e,t.y=i,t},names:["Van_der_Grinten_I","VanDerGrinten","vandg"]};const Ns={init:function(){this.sin_p12=Math.sin(this.lat0),this.cos_p12=Math.cos(this.lat0)},forward:function(t){var e,i,s,r,a,n,o,l,h,c,u,d,p,m,f,_,y,g,v,M,C,x,b=t.x,w=t.y,P=Math.sin(t.y),S=Math.cos(t.y),T=je(b-this.long0);return this.sphere?Math.abs(this.sin_p12-1)<=ue?(t.x=this.x0+this.a*(ce-w)*Math.sin(T),t.y=this.y0-this.a*(ce-w)*Math.cos(T),t):Math.abs(this.sin_p12+1)<=ue?(t.x=this.x0+this.a*(ce+w)*Math.sin(T),t.y=this.y0+this.a*(ce+w)*Math.cos(T),t):(g=this.sin_p12*P+this.cos_p12*S*Math.cos(T),y=(_=Math.acos(g))?_/Math.sin(_):1,t.x=this.x0+this.a*y*S*Math.sin(T),t.y=this.y0+this.a*y*(this.cos_p12*P-this.sin_p12*S*Math.cos(T)),t):(e=hs(this.es),i=cs(this.es),s=us(this.es),r=ds(this.es),Math.abs(this.sin_p12-1)<=ue?(a=this.a*ls(e,i,s,r,ce),n=this.a*ls(e,i,s,r,w),t.x=this.x0+(a-n)*Math.sin(T),t.y=this.y0-(a-n)*Math.cos(T),t):Math.abs(this.sin_p12+1)<=ue?(a=this.a*ls(e,i,s,r,ce),n=this.a*ls(e,i,s,r,w),t.x=this.x0+(a+n)*Math.sin(T),t.y=this.y0+(a+n)*Math.cos(T),t):(o=P/S,l=ps(this.a,this.e,this.sin_p12),h=ps(this.a,this.e,P),c=Math.atan((1-this.es)*o+this.es*l*this.sin_p12/(h*S)),v=0===(u=Math.atan2(Math.sin(T),this.cos_p12*Math.tan(c)-this.sin_p12*Math.cos(T)))?Math.asin(this.cos_p12*Math.sin(c)-this.sin_p12*Math.cos(c)):Math.abs(Math.abs(u)-Math.PI)<=ue?-Math.asin(this.cos_p12*Math.sin(c)-this.sin_p12*Math.cos(c)):Math.asin(Math.sin(T)*Math.cos(c)/Math.sin(u)),d=this.e*this.sin_p12/Math.sqrt(1-this.es),_=l*v*(1-(M=v*v)*(f=(p=this.e*this.cos_p12*Math.cos(u)/Math.sqrt(1-this.es))*p)*(1-f)/6+(C=M*v)/8*(m=d*p)*(1-2*f)+(x=C*v)/120*(f*(4-7*f)-3*d*d*(1-7*f))-x*v/48*m),t.x=this.x0+_*Math.sin(u),t.y=this.y0+_*Math.cos(u),t))},inverse:function(t){var e,i,s,r,a,n,o,l,h,c,u,d,p,m,f,_,y,g,v,M,C,x,b;if(t.x-=this.x0,t.y-=this.y0,this.sphere){if((e=Math.sqrt(t.x*t.x+t.y*t.y))>2*ce*this.a)return;return i=e/this.a,s=Math.sin(i),r=Math.cos(i),a=this.long0,Math.abs(e)<=ue?n=this.lat0:(n=Ps(r*this.sin_p12+t.y*s*this.cos_p12/e),o=Math.abs(this.lat0)-ce,a=Math.abs(o)<=ue?this.lat0>=0?je(this.long0+Math.atan2(t.x,-t.y)):je(this.long0-Math.atan2(-t.x,t.y)):je(this.long0+Math.atan2(t.x*s,e*this.cos_p12*r-t.y*this.sin_p12*s))),t.x=a,t.y=n,t}return l=hs(this.es),h=cs(this.es),c=us(this.es),u=ds(this.es),Math.abs(this.sin_p12-1)<=ue?(n=fs(((d=this.a*ls(l,h,c,u,ce))-(e=Math.sqrt(t.x*t.x+t.y*t.y)))/this.a,l,h,c,u),a=je(this.long0+Math.atan2(t.x,-1*t.y)),t.x=a,t.y=n,t):Math.abs(this.sin_p12+1)<=ue?(d=this.a*ls(l,h,c,u,ce),n=fs(((e=Math.sqrt(t.x*t.x+t.y*t.y))-d)/this.a,l,h,c,u),a=je(this.long0+Math.atan2(t.x,t.y)),t.x=a,t.y=n,t):(e=Math.sqrt(t.x*t.x+t.y*t.y),f=Math.atan2(t.x,t.y),p=ps(this.a,this.e,this.sin_p12),_=Math.cos(f),g=-(y=this.e*this.cos_p12*_)*y/(1-this.es),v=3*this.es*(1-g)*this.sin_p12*this.cos_p12*_/(1-this.es),x=1-g*(C=(M=e/p)-g*(1+g)*Math.pow(M,3)/6-v*(1+3*g)*Math.pow(M,4)/24)*C/2-M*C*C*C/6,m=Math.asin(this.sin_p12*Math.cos(C)+this.cos_p12*Math.sin(C)*_),a=je(this.long0+Math.asin(Math.sin(f)*Math.sin(C)/Math.cos(m))),b=Math.sin(m),n=Math.atan2((b-this.es*x*this.sin_p12)*Math.tan(m),b*(1-this.es)),t.x=a,t.y=n,t)},names:["Azimuthal_Equidistant","aeqd"]};const Gs={init:function(){this.sin_p14=Math.sin(this.lat0),this.cos_p14=Math.cos(this.lat0)},forward:function(t){var e,i,s,r,a,n,o,l=t.x,h=t.y;return s=je(l-this.long0),e=Math.sin(h),i=Math.cos(h),r=Math.cos(s),((a=this.sin_p14*e+this.cos_p14*i*r)>0||Math.abs(a)<=ue)&&(n=1*this.a*i*Math.sin(s),o=this.y0+1*this.a*(this.cos_p14*e-this.sin_p14*i*r)),t.x=n,t.y=o,t},inverse:function(t){var e,i,s,r,a,n,o;return t.x-=this.x0,t.y-=this.y0,i=Ps((e=Math.sqrt(t.x*t.x+t.y*t.y))/this.a),s=Math.sin(i),r=Math.cos(i),n=this.long0,Math.abs(e)<=ue?(o=this.lat0,t.x=n,t.y=o,t):(o=Ps(r*this.sin_p14+t.y*s*this.cos_p14/e),a=Math.abs(this.lat0)-ce,Math.abs(a)<=ue?(n=this.lat0>=0?je(this.long0+Math.atan2(t.x,-t.y)):je(this.long0-Math.atan2(-t.x,t.y)),t.x=n,t.y=o,t):(n=je(this.long0+Math.atan2(t.x*s,e*this.cos_p14*r-t.y*this.sin_p14*s)),t.x=n,t.y=o,t))},names:["ortho"]};var Vs=1,js=2,Fs=3,Ws=4,qs=5,Bs=6,Hs=1,Us=2,Ks=3,Zs=4;function Xs(t,e,i,s){var r;return t<ue?(s.value=Hs,r=0):(r=Math.atan2(e,i),Math.abs(r)<=me?s.value=Hs:r>me&&r<=ce+me?(s.value=Us,r-=ce):r>ce+me||r<=-(ce+me)?(s.value=Ks,r=r>=0?r-_e:r+_e):(s.value=Zs,r+=ce)),r}function Js(t,e){var i=t+e;return i<-_e?i+=fe:i>+_e&&(i-=fe),i}const Ys={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.lat0=this.lat0||0,this.long0=this.long0||0,this.lat_ts=this.lat_ts||0,this.title=this.title||"Quadrilateralized Spherical Cube",this.lat0>=ce-me/2?this.face=qs:this.lat0<=-(ce-me/2)?this.face=Bs:Math.abs(this.long0)<=me?this.face=Vs:Math.abs(this.long0)<=ce+me?this.face=this.long0>0?js:Ws:this.face=Fs,0!==this.es&&(this.one_minus_f=1-(this.a-this.b)/this.a,this.one_minus_f_squared=this.one_minus_f*this.one_minus_f)},forward:function(t){var e,i,s,r,a,n,o,l,h,c,u,d,p={x:0,y:0},m={value:0};return t.x-=this.long0,e=0!==this.es?Math.atan(this.one_minus_f_squared*Math.tan(t.y)):t.y,i=t.x,this.face===qs?(r=ce-e,i>=me&&i<=ce+me?(m.value=Hs,s=i-ce):i>ce+me||i<=-(ce+me)?(m.value=Us,s=i>0?i-_e:i+_e):i>-(ce+me)&&i<=-me?(m.value=Ks,s=i+ce):(m.value=Zs,s=i)):this.face===Bs?(r=ce+e,i>=me&&i<=ce+me?(m.value=Hs,s=-i+ce):i<me&&i>=-me?(m.value=Us,s=-i):i<-me&&i>=-(ce+me)?(m.value=Ks,s=-i-ce):(m.value=Zs,s=i>0?-i+_e:-i-_e)):(this.face===js?i=Js(i,+ce):this.face===Fs?i=Js(i,+_e):this.face===Ws&&(i=Js(i,-ce)),c=Math.sin(e),u=Math.cos(e),d=Math.sin(i),o=u*Math.cos(i),l=u*d,h=c,this.face===Vs?s=Xs(r=Math.acos(o),h,l,m):this.face===js?s=Xs(r=Math.acos(l),h,-o,m):this.face===Fs?s=Xs(r=Math.acos(-o),h,-l,m):this.face===Ws?s=Xs(r=Math.acos(-l),h,o,m):(r=s=0,m.value=Hs)),n=Math.atan(12/_e*(s+Math.acos(Math.sin(s)*Math.cos(me))-ce)),a=Math.sqrt((1-Math.cos(r))/(Math.cos(n)*Math.cos(n))/(1-Math.cos(Math.atan(1/Math.cos(s))))),m.value===Us?n+=ce:m.value===Ks?n+=_e:m.value===Zs&&(n+=1.5*_e),p.x=a*Math.cos(n),p.y=a*Math.sin(n),p.x=p.x*this.a+this.x0,p.y=p.y*this.a+this.y0,t.x=p.x,t.y=p.y,t},inverse:function(t){var e,i,s,r,a,n,o,l,h,c,u,d,p,m,f,_={lam:0,phi:0},y={value:0};return t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a,i=Math.atan(Math.sqrt(t.x*t.x+t.y*t.y)),e=Math.atan2(t.y,t.x),t.x>=0&&t.x>=Math.abs(t.y)?y.value=Hs:t.y>=0&&t.y>=Math.abs(t.x)?(y.value=Us,e-=ce):t.x<0&&-t.x>=Math.abs(t.y)?(y.value=Ks,e=e<0?e+_e:e-_e):(y.value=Zs,e+=ce),h=_e/12*Math.tan(e),a=Math.sin(h)/(Math.cos(h)-1/Math.sqrt(2)),n=Math.atan(a),(o=1-(s=Math.cos(e))*s*(r=Math.tan(i))*r*(1-Math.cos(Math.atan(1/Math.cos(n)))))<-1?o=-1:o>1&&(o=1),this.face===qs?(l=Math.acos(o),_.phi=ce-l,y.value===Hs?_.lam=n+ce:y.value===Us?_.lam=n<0?n+_e:n-_e:y.value===Ks?_.lam=n-ce:_.lam=n):this.face===Bs?(l=Math.acos(o),_.phi=l-ce,y.value===Hs?_.lam=-n+ce:y.value===Us?_.lam=-n:y.value===Ks?_.lam=-n-ce:_.lam=n<0?-n-_e:-n+_e):(h=(c=o)*c,u=(h+=(d=h>=1?0:Math.sqrt(1-h)*Math.sin(n))*d)>=1?0:Math.sqrt(1-h),y.value===Us?(h=u,u=-d,d=h):y.value===Ks?(u=-u,d=-d):y.value===Zs&&(h=u,u=d,d=-h),this.face===js?(h=c,c=-u,u=h):this.face===Fs?(c=-c,u=-u):this.face===Ws&&(h=c,c=u,u=-h),_.phi=Math.acos(-d)-ce,_.lam=Math.atan2(u,c),this.face===js?_.lam=Js(_.lam,-ce):this.face===Fs?_.lam=Js(_.lam,-_e):this.face===Ws&&(_.lam=Js(_.lam,+ce))),0!==this.es&&(p=_.phi<0?1:0,m=Math.tan(_.phi),f=this.b/Math.sqrt(m*m+this.one_minus_f_squared),_.phi=Math.atan(Math.sqrt(this.a*this.a-f*f)/(this.one_minus_f*f)),p&&(_.phi=-_.phi)),_.lam+=this.long0,t.x=_.lam,t.y=_.phi,t},names:["Quadrilateralized Spherical Cube","Quadrilateralized_Spherical_Cube","qsc"]};var Qs=[[1,22199e-21,-715515e-10,31103e-10],[.9986,-482243e-9,-24897e-9,-13309e-10],[.9954,-83103e-8,-448605e-10,-9.86701e-7],[.99,-.00135364,-59661e-9,36777e-10],[.9822,-.00167442,-449547e-11,-572411e-11],[.973,-.00214868,-903571e-10,1.8736e-8],[.96,-.00305085,-900761e-10,164917e-11],[.9427,-.00382792,-653386e-10,-26154e-10],[.9216,-.00467746,-10457e-8,481243e-11],[.8962,-.00536223,-323831e-10,-543432e-11],[.8679,-.00609363,-113898e-9,332484e-11],[.835,-.00698325,-640253e-10,9.34959e-7],[.7986,-.00755338,-500009e-10,9.35324e-7],[.7597,-.00798324,-35971e-9,-227626e-11],[.7186,-.00851367,-701149e-10,-86303e-10],[.6732,-.00986209,-199569e-9,191974e-10],[.6213,-.010418,883923e-10,624051e-11],[.5722,-.00906601,182e-6,624051e-11],[.5322,-.00677797,275608e-9,624051e-11]],$s=[[-520417e-23,.0124,121431e-23,-845284e-16],[.062,.0124,-1.26793e-9,4.22642e-10],[.124,.0124,5.07171e-9,-1.60604e-9],[.186,.0123999,-1.90189e-8,6.00152e-9],[.248,.0124002,7.10039e-8,-2.24e-8],[.31,.0123992,-2.64997e-7,8.35986e-8],[.372,.0124029,9.88983e-7,-3.11994e-7],[.434,.0123893,-369093e-11,-4.35621e-7],[.4958,.0123198,-102252e-10,-3.45523e-7],[.5571,.0121916,-154081e-10,-5.82288e-7],[.6176,.0119938,-241424e-10,-5.25327e-7],[.6769,.011713,-320223e-10,-5.16405e-7],[.7346,.0113541,-397684e-10,-6.09052e-7],[.7903,.0109107,-489042e-10,-104739e-11],[.8435,.0103431,-64615e-9,-1.40374e-9],[.8936,.00969686,-64636e-9,-8547e-9],[.9394,.00840947,-192841e-9,-42106e-10],[.9761,.00616527,-256e-6,-42106e-10],[1,.00328947,-319159e-9,-42106e-10]],tr=.8487,er=1.3523,ir=pe/5,sr=1/ir,rr=18,ar=function(t,e){return t[0]+e*(t[1]+e*(t[2]+e*t[3]))};const nr={init:function(){this.x0=this.x0||0,this.y0=this.y0||0,this.long0=this.long0||0,this.es=0,this.title=this.title||"Robinson"},forward:function(t){var e=je(t.x-this.long0),i=Math.abs(t.y),s=Math.floor(i*ir);s<0?s=0:s>=rr&&(s=17);var r={x:ar(Qs[s],i=pe*(i-sr*s))*e,y:ar($s[s],i)};return t.y<0&&(r.y=-r.y),r.x=r.x*this.a*tr+this.x0,r.y=r.y*this.a*er+this.y0,r},inverse:function(t){var e={x:(t.x-this.x0)/(this.a*tr),y:Math.abs(t.y-this.y0)/(this.a*er)};if(e.y>=1)e.x/=Qs[18][0],e.y=t.y<0?-ce:ce;else{var i=Math.floor(e.y*rr);for(i<0?i=0:i>=rr&&(i=17);;)if($s[i][0]>e.y)--i;else{if(!($s[i+1][0]<=e.y))break;++i}var s=$s[i],r=5*(e.y-s[0])/($s[i+1][0]-s[0]);r=function(t,e,i,s){for(var r=e;s;--s){var a=t(r);if(r-=a,Math.abs(a)<i)break}return r}((function(t){return(ar(s,t)-e.y)/function(t,e){return t[1]+e*(2*t[2]+3*e*t[3])}(s,t)}),r,ue,100),e.x/=ar(Qs[i],r),e.y=(5*i+r)*de,t.y<0&&(e.y=-e.y)}return e.x=je(e.x+this.long0),e},names:["Robinson","robin"]};const or={init:function(){this.name="geocent"},forward:function(t){return ni(t,this.es,this.a)},inverse:function(t){return oi(t,this.es,this.a,this.b)},names:["Geocentric","geocentric","geocent","Geocent"]};var lr=0,hr=1,cr=2,ur=3,dr={h:{def:1e5,num:!0},azi:{def:0,num:!0,degrees:!0},tilt:{def:0,num:!0,degrees:!0},long0:{def:0,num:!0},lat0:{def:0,num:!0}};const pr={init:function(){if(Object.keys(dr).forEach(function(t){if(void 0===this[t])this[t]=dr[t].def;else{if(dr[t].num&&isNaN(this[t]))throw new Error("Invalid parameter value, must be numeric "+t+" = "+this[t]);dr[t].num&&(this[t]=parseFloat(this[t]))}dr[t].degrees&&(this[t]=this[t]*de)}.bind(this)),Math.abs(Math.abs(this.lat0)-ce)<ue?this.mode=this.lat0<0?hr:lr:Math.abs(this.lat0)<ue?this.mode=cr:(this.mode=ur,this.sinph0=Math.sin(this.lat0),this.cosph0=Math.cos(this.lat0)),this.pn1=this.h/this.a,this.pn1<=0||this.pn1>1e10)throw new Error("Invalid height");this.p=1+this.pn1,this.rp=1/this.p,this.h1=1/this.pn1,this.pfact=(this.p+1)*this.h1,this.es=0;var t=this.tilt,e=this.azi;this.cg=Math.cos(e),this.sg=Math.sin(e),this.cw=Math.cos(t),this.sw=Math.sin(t)},forward:function(t){t.x-=this.long0;var e,i,s,r,a=Math.sin(t.y),n=Math.cos(t.y),o=Math.cos(t.x);switch(this.mode){case ur:i=this.sinph0*a+this.cosph0*n*o;break;case cr:i=n*o;break;case hr:i=-a;break;case lr:i=a}switch(e=(i=this.pn1/(this.p-i))*n*Math.sin(t.x),this.mode){case ur:i*=this.cosph0*a-this.sinph0*n*o;break;case cr:i*=a;break;case lr:i*=-n*o;break;case hr:i*=n*o}return r=1/((s=i*this.cg+e*this.sg)*this.sw*this.h1+this.cw),e=(e*this.cg-i*this.sg)*this.cw*r,i=s*r,t.x=e*this.a,t.y=i*this.a,t},inverse:function(t){t.x/=this.a,t.y/=this.a;var e,i,s,r={x:t.x,y:t.y};s=1/(this.pn1-t.y*this.sw),e=this.pn1*t.x*s,i=this.pn1*t.y*this.cw*s,t.x=e*this.cg+i*this.sg,t.y=i*this.cg-e*this.sg;var a=Ki(t.x,t.y);if(Math.abs(a)<ue)r.x=0,r.y=t.y;else{var n,o;switch(o=1-a*a*this.pfact,o=(this.p-Math.sqrt(o))/(this.pn1/a+a/this.pn1),n=Math.sqrt(1-o*o),this.mode){case ur:r.y=Math.asin(n*this.sinph0+t.y*o*this.cosph0/a),t.y=(n-this.sinph0*Math.sin(r.y))*a,t.x*=o*this.cosph0;break;case cr:r.y=Math.asin(t.y*o/a),t.y=n*a,t.x*=o;break;case lr:r.y=Math.asin(n),t.y=-t.y;break;case hr:r.y=-Math.asin(n)}r.x=Math.atan2(t.x,t.y)}return t.x=r.x+this.long0,t.y=r.y,t},names:["Tilted_Perspective","tpers"]};const mr={init:function(){if(this.flip_axis="x"===this.sweep?1:0,this.h=Number(this.h),this.radius_g_1=this.h/this.a,this.radius_g_1<=0||this.radius_g_1>1e10)throw new Error;if(this.radius_g=1+this.radius_g_1,this.C=this.radius_g*this.radius_g-1,0!==this.es){var t=1-this.es,e=1/t;this.radius_p=Math.sqrt(t),this.radius_p2=t,this.radius_p_inv2=e,this.shape="ellipse"}else this.radius_p=1,this.radius_p2=1,this.radius_p_inv2=1,this.shape="sphere";!this.title&&(this.title="Geostationary Satellite View")},forward:function(t){var e,i,s,r,a=t.x,n=t.y;if(a-=this.long0,"ellipse"===this.shape){n=Math.atan(this.radius_p2*Math.tan(n));var o=this.radius_p/Ki(this.radius_p*Math.cos(n),Math.sin(n));if(i=o*Math.cos(a)*Math.cos(n),s=o*Math.sin(a)*Math.cos(n),r=o*Math.sin(n),(this.radius_g-i)*i-s*s-r*r*this.radius_p_inv2<0)return t.x=Number.NaN,t.y=Number.NaN,t;e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/Ki(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(r/Ki(s,e)))}else"sphere"===this.shape&&(e=Math.cos(n),i=Math.cos(a)*e,s=Math.sin(a)*e,r=Math.sin(n),e=this.radius_g-i,this.flip_axis?(t.x=this.radius_g_1*Math.atan(s/Ki(r,e)),t.y=this.radius_g_1*Math.atan(r/e)):(t.x=this.radius_g_1*Math.atan(s/e),t.y=this.radius_g_1*Math.atan(r/Ki(s,e))));return t.x=t.x*this.a,t.y=t.y*this.a,t},inverse:function(t){var e,i,s,r,a=-1,n=0,o=0;if(t.x=t.x/this.a,t.y=t.y/this.a,"ellipse"===this.shape){this.flip_axis?(o=Math.tan(t.y/this.radius_g_1),n=Math.tan(t.x/this.radius_g_1)*Ki(1,o)):(n=Math.tan(t.x/this.radius_g_1),o=Math.tan(t.y/this.radius_g_1)*Ki(1,n));var l=o/this.radius_p;if(e=n*n+l*l+a*a,(s=(i=2*this.radius_g*a)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(s))/(2*e),a=this.radius_g+r*a,n*=r,o*=r,t.x=Math.atan2(n,a),t.y=Math.atan(o*Math.cos(t.x)/a),t.y=Math.atan(this.radius_p_inv2*Math.tan(t.y))}else if("sphere"===this.shape){if(this.flip_axis?(o=Math.tan(t.y/this.radius_g_1),n=Math.tan(t.x/this.radius_g_1)*Math.sqrt(1+o*o)):(n=Math.tan(t.x/this.radius_g_1),o=Math.tan(t.y/this.radius_g_1)*Math.sqrt(1+n*n)),e=n*n+o*o+a*a,(s=(i=2*this.radius_g*a)*i-4*e*this.C)<0)return t.x=Number.NaN,t.y=Number.NaN,t;r=(-i-Math.sqrt(s))/(2*e),a=this.radius_g+r*a,n*=r,o*=r,t.x=Math.atan2(n,a),t.y=Math.atan(o*Math.cos(t.x)/a)}return t.x=t.x+this.long0,t},names:["Geostationary Satellite View","Geostationary_Satellite","geos"]};var fr=1.340264,_r=-.081106,yr=893e-6,gr=.003796,vr=Math.sqrt(3)/2;const Mr={init:function(){this.es=0,this.long0=void 0!==this.long0?this.long0:0},forward:function(t){var e=je(t.x-this.long0),i=t.y,s=Math.asin(vr*Math.sin(i)),r=s*s,a=r*r*r;return t.x=e*Math.cos(s)/(vr*(fr+3*_r*r+a*(7*yr+9*gr*r))),t.y=s*(fr+_r*r+a*(yr+gr*r)),t.x=this.a*t.x+this.x0,t.y=this.a*t.y+this.y0,t},inverse:function(t){t.x=(t.x-this.x0)/this.a,t.y=(t.y-this.y0)/this.a;var e,i,s,r,a=t.y;for(r=0;r<12&&(a-=s=(a*(fr+_r*(e=a*a)+(i=e*e*e)*(yr+gr*e))-t.y)/(fr+3*_r*e+i*(7*yr+9*gr*e)),!(Math.abs(s)<1e-9));++r);return i=(e=a*a)*e*e,t.x=vr*t.x*(fr+3*_r*e+i*(7*yr+9*gr*e))/Math.cos(a),t.y=Math.asin(Math.sin(a)/vr),t.x=je(t.x+this.long0),t},names:["eqearth","Equal Earth","Equal_Earth"]};var Cr=1e-10;function xr(t){var e,i,s,r=je(t.x-(this.long0||0)),a=t.y;return e=this.am1+this.m1-qi(a,i=Math.sin(a),s=Math.cos(a),this.en),i=s*r/(e*Math.sqrt(1-this.es*i*i)),t.x=e*Math.sin(i),t.y=this.am1-e*Math.cos(i),t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function br(t){var e,i,s,r;if(t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a,i=Ki(t.x,t.y=this.am1-t.y),r=Bi(this.am1+this.m1-i,this.es,this.en),(e=Math.abs(r))<ce)e=Math.sin(r),s=i*Math.atan2(t.x,t.y)*Math.sqrt(1-this.es*e*e)/Math.cos(r);else{if(!(Math.abs(e-ce)<=Cr))throw new Error;s=0}return t.x=je(s+(this.long0||0)),t.y=ms(r),t}function wr(t){var e,i,s=je(t.x-(this.long0||0)),r=t.y;return i=this.cphi1+this.phi1-r,Math.abs(i)>Cr?(t.x=i*Math.sin(e=s*Math.cos(r)/i),t.y=this.cphi1-i*Math.cos(e)):t.x=t.y=0,t.x=this.a*t.x+(this.x0||0),t.y=this.a*t.y+(this.y0||0),t}function Pr(t){t.x=(t.x-(this.x0||0))/this.a,t.y=(t.y-(this.y0||0))/this.a;var e,i,s=Ki(t.x,t.y=this.cphi1-t.y);if(i=this.cphi1+this.phi1-s,Math.abs(i)>ce)throw new Error;return e=Math.abs(Math.abs(i)-ce)<=Cr?0:s*Math.atan2(t.x,t.y)/Math.cos(i),t.x=je(e+(this.long0||0)),t.y=ms(i),t}const Sr={init:function(){var t;if(this.phi1=this.lat1,Math.abs(this.phi1)<Cr)throw new Error;this.es?(this.en=Wi(this.es),this.m1=qi(this.phi1,this.am1=Math.sin(this.phi1),t=Math.cos(this.phi1),this.en),this.am1=t/(Math.sqrt(1-this.es*this.am1*this.am1)*this.am1),this.inverse=br,this.forward=xr):(Math.abs(this.phi1)+Cr>=ce?this.cphi1=0:this.cphi1=1/Math.tan(this.phi1),this.inverse=Pr,this.forward=wr)},names:["bonne","Bonne (Werner lat_1=90)"]};var Tr;function Er(t){t=Math.abs(t);const e=Math.floor(t),i=Math.floor(60*(t-e)),s=Math.round(3600*(t-e)%60);return{degree:e,minute:i,second:s,str:e+"° "+i+"'  "+s+'"'}}function kr(t,e,i){return Math.abs(t)+e/60+i/3600}function Ir(t,e,i=!0){let s;if(e){const e=Math.floor(t/6)+1;if(e<13||e>23)return;s=i?e+4478:e+4489}else{const e=Math.floor((t-1.5)/3)+1;if(e<25||e>45)return;s=i?e+4488:e+4509}return"EPSG:"+s}function Lr(t){const e=Number.parseInt(t.toString().slice(0,2));return e>=13&&e<=23?"EPSG:"+(e+4478):e>=25&&e<=45?"EPSG:"+(e+4488):void 0}function Ar(t,e=!1){const i=u.Cartographic.fromCartesian(t);if(!i)return null;const s=A.FormatLength,r=A.FormatAltLength,a=u.Math.toDegrees(i.longitude).toFixed(s),n=u.Math.toDegrees(i.latitude).toFixed(s);if(e)return[Number.parseFloat(a),Number.parseFloat(n)];{const t=i.height.toFixed(r);return[Number.parseFloat(a),Number.parseFloat(n),Number.parseFloat(t)]}}function Or(t,e=!1){const i=[];for(let s=0,r=t.length;s<r;s++){const r=Ar(t[s],e);r&&i.push(r)}return i}function zr(t){if(!t)return null;const e=Ar(t);return e?Gr(e):null}function Rr(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=zr(t[i]);s&&e.push(s)}return e.length>0?e:null}function Dr(t,e=0){return!t||t.length<2?null:u.Cartesian3.fromDegrees(t[0],t[1],t[2]||e)}function Nr(t,e){const i=[];for(let s=0,r=t.length;s<r;s++){const r=t[s];if(Array.isArray(r[0])){const t=Nr(r,e);t&&t.length>0&&i.push(t)}else{const t=Dr(r,e);t&&i.push(t)}}return i}function Gr(t){return sa(t)}function Vr(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=Gr(t[i]);s&&e.push(s)}return e}function jr(t,e){if(Number.isNaN(t[0])||Number.isNaN(t[1]))return null;const i=Wr(t);return u.defined(e)&&(i[2]=e),Dr(i)}function Fr(t,e){const i=[];for(let s=0,r=t.length;s<r;s++){const r=jr(t[s],e);r&&i.push(r)}return i}function Wr(t){return ra(t)}function qr(t){const e=[];for(let i=0,s=t.length;i<s;i++){const s=Wr(t[i]);s&&e.push(s)}return e}Mi.defaultDatum="WGS84",Mi.Proj=ai,Mi.WGS84=new Mi.Proj("WGS84"),Mi.Point=Gi,Mi.toPoint=mi,Mi.defs=Oe,Mi.nadgrid=function(t,e){var i=new DataView(e),s=function(t){var e=t.getInt32(8,!1);return 11!==e&&(e=t.getInt32(8,!0),11!==e&&console.warn("Failed to detect nadgrid endian-ness, defaulting to little-endian"),!0)}(i),r=function(t,e){return{nFields:t.getInt32(8,e),nSubgridFields:t.getInt32(24,e),nSubgrids:t.getInt32(40,e),shiftType:ei(t,56,64).trim(),fromSemiMajorAxis:t.getFloat64(120,e),fromSemiMinorAxis:t.getFloat64(136,e),toSemiMajorAxis:t.getFloat64(152,e),toSemiMinorAxis:t.getFloat64(168,e)}}(i,s),a=function(t,e,i){for(var s=176,r=[],a=0;a<e.nSubgrids;a++){var n=si(t,s,i),o=ri(t,s,n,i),l=Math.round(1+(n.upperLongitude-n.lowerLongitude)/n.longitudeInterval),h=Math.round(1+(n.upperLatitude-n.lowerLatitude)/n.latitudeInterval);r.push({ll:[ti(n.lowerLongitude),ti(n.lowerLatitude)],del:[ti(n.longitudeInterval),ti(n.latitudeInterval)],lim:[l,h],count:n.gridNodeCount,cvs:ii(o)}),s+=176+16*n.gridNodeCount}return r}(i,r,s),n={header:r,subgrids:a};return Qe[t]=n,n},Mi.transform=_i,Mi.mgrs=Ei,Mi.version="__VERSION__",(Tr=Mi).Proj.projections.add(Hi),Tr.Proj.projections.add(Yi),Tr.Proj.projections.add(Qi),Tr.Proj.projections.add(es),Tr.Proj.projections.add(is),Tr.Proj.projections.add(ss),Tr.Proj.projections.add(as),Tr.Proj.projections.add(ns),Tr.Proj.projections.add(os),Tr.Proj.projections.add(_s),Tr.Proj.projections.add(ws),Tr.Proj.projections.add(Ss),Tr.Proj.projections.add(Ts),Tr.Proj.projections.add(Es),Tr.Proj.projections.add(ks),Tr.Proj.projections.add(Is),Tr.Proj.projections.add(Ls),Tr.Proj.projections.add(As),Tr.Proj.projections.add(Os),Tr.Proj.projections.add(zs),Tr.Proj.projections.add(Rs),Tr.Proj.projections.add(Ds),Tr.Proj.projections.add(Ns),Tr.Proj.projections.add(Gs),Tr.Proj.projections.add(Ys),Tr.Proj.projections.add(nr),Tr.Proj.projections.add(or),Tr.Proj.projections.add(pr),Tr.Proj.projections.add(mr),Tr.Proj.projections.add(Mr),Tr.Proj.projections.add(Sr);const Br=52.35987755982988,Hr=3.141592653589793,Ur=6378245,Kr=.006693421622965943;function Zr(t,e){let i=300+t+2*e+.1*t*t+.1*t*e+.1*Math.sqrt(Math.abs(t));return i+=2*(20*Math.sin(6*t*Math.PI)+20*Math.sin(2*t*Math.PI))/3,i+=2*(20*Math.sin(t*Math.PI)+40*Math.sin(t/3*Math.PI))/3,i+=2*(150*Math.sin(t/12*Math.PI)+300*Math.sin(t/30*Math.PI))/3,i}function Xr(t,e){let i=2*t-100+3*e+.2*e*e+.1*t*e+.2*Math.sqrt(Math.abs(t));return i+=2*(20*Math.sin(6*t*Math.PI)+20*Math.sin(2*t*Math.PI))/3,i+=2*(20*Math.sin(e*Math.PI)+40*Math.sin(e/3*Math.PI))/3,i+=2*(160*Math.sin(e/12*Math.PI)+320*Math.sin(e*Math.PI/30))/3,i}function Jr(t,e){return t<72.004||t>137.8347||e<.8293||e>55.8271}function Yr(t){const e=t[0]-.0065,i=t[1]-.006,s=Math.sqrt(e*e+i*i)-2e-5*Math.sin(i*Br),r=Math.atan2(i,e)-3e-6*Math.cos(e*Br);let a=s*Math.cos(r),n=s*Math.sin(r);return a=Number(a.toFixed(6)),n=Number(n.toFixed(6)),[a,n]}function Qr(t){const e=t[0],i=t[1],s=Math.sqrt(e*e+i*i)+2e-5*Math.sin(i*Br),r=Math.atan2(i,e)+3e-6*Math.cos(e*Br);let a=s*Math.cos(r)+.0065,n=s*Math.sin(r)+.006;return a=Number(a.toFixed(6)),n=Number(n.toFixed(6)),[a,n]}function $r(t){const e=t[0],i=t[1];if(Jr(e,i))return[e,i];{let t=Xr(e-105,i-35),s=Zr(e-105,i-35);const r=i/180*Hr;let a=Math.sin(r);a=1-Kr*a*a;const n=Math.sqrt(a);t=180*t/(Ur*(1-Kr)/(a*n)*Hr),s=180*s/(Ur/n*Math.cos(r)*Hr);let o=i+t,l=e+s;return l=Number(l.toFixed(6)),o=Number(o.toFixed(6)),[l,o]}}function ta(t){const e=t[0],i=t[1];if(Jr(e,i))return[e,i];{let t=Xr(e-105,i-35),s=Zr(e-105,i-35);const r=i/180*Hr;let a=Math.sin(r);a=1-Kr*a*a;const n=Math.sqrt(a);t=180*t/(Ur*(1-Kr)/(a*n)*Hr),s=180*s/(Ur/n*Math.cos(r)*Hr);let o=2*e-(e+s),l=2*i-(i+t);return o=Number(o.toFixed(6)),l=Number(l.toFixed(6)),[o,l]}}function ea(t){return ta(Yr(t))}function ia(t){return Qr($r(t))}function sa(t){const e=Number(t[0]),i=Number(t[1]);let s=20037508.34*e/180,r=Math.log(Math.tan((90+i)*Math.PI/360))/(Math.PI/180);return r=20037508.34*r/180,s=Number(s.toFixed(2)),r=Number(r.toFixed(2)),[s,r,t[2]||0]}function ra(t){let e=Number(t[0])/20037508.34*180,i=Number(t[1])/20037508.34*180;return i=180/Math.PI*(2*Math.atan(Math.exp(i*Math.PI/180))-Math.PI/2),e=Number(e.toFixed(6)),i=Number(i.toFixed(6)),[e,i,t[2]||0]}function aa(t,e,i="EPSG:4326"){if(!e||!i||e==i)return t;try{if((e==z.CGCS2000_GK_Zone_3||e==z.CGCS2000_GK_Zone_6)&&(e=Lr(t[0])),i==z.CGCS2000_GK_Zone_3?i=Ir(t[0],!1,!0):i==z.CGCS2000_GK_Zone_6?i=Ir(t[0],!0,!0):i==z.CGCS2000_GK_CM_3?i=Ir(t[0],!1,!1):i==z.CGCS2000_GK_CM_6&&(i=Ir(t[0],!0,!1)),!e||!i||e==i)return t;const s=Mi(e,i,t);if(u.defined(s)&&s.length>1&&!Number.isNaN(s[0])&&s[0]!=1/0)return s}catch(s){}return t}function na(t,e,i="EPSG:4326"){if(!e||e==i)return t;const s=[];for(let r=0,a=t.length;r<a;r++){const a=t[r];if(Array.isArray(a[0])){const t=na(a,e,i);t&&t.length>0&&s.push(t)}else{const t=aa(a,e,i);t&&s.push(t)}}return s}const oa=Object.freeze(Object.defineProperty({__proto__:null,bd2gcj:Yr,bd2wgs:ea,cartesian2lonlat:Ar,cartesian2mercator:zr,cartesians2lonlats:Or,cartesians2mercators:Rr,degree2dms:Er,dms2degree:kr,gcj2bd:Qr,gcj2wgs:ta,getCGCS2000EPSGByLng:Ir,getCGCS2000EPSGByX:Lr,jwd2mct:sa,lonlat2cartesian:Dr,lonlat2mercator:Gr,lonlats2cartesians:Nr,lonlats2mercators:Vr,mct2jwd:ra,mercator2cartesian:jr,mercator2lonlat:Wr,mercators2cartesians:Fr,mercators2lonlats:qr,proj4Trans:aa,proj4TransArr:na,wgs2bd:ia,wgs2gcj:$r},Symbol.toStringTag,{value:"Module"}));function la(t,e){t.cesiumWidget.showErrorPanel=e}function ha(t,e,i={}){if(!e)return e;return u.defaultValue(i.has3dtiles,u.defined(ca(t,e)))?ua(t,e,i):da(t,e,i)}function ca(t,e){if(!e)return null;e instanceof u.Cartesian3&&(e=[e]);for(let i=0,s=e.length;i<s;++i){const s=e[i],r=u.SceneTransforms.worldToWindowCoordinates(t.scene,s);if(!u.defined(r))continue;const a=t.scene.pick(r,10,10);if(u.defined(a)&&u.defined(a.primitive)&&a.primitive instanceof u.Cesium3DTileset)return a.primitive}return null}function ua(t,e,i={}){i.cartographic=i.cartographic||u.Cartographic.fromCartesian(e);const{cartographic:s,callback:r}=i;if(i.async)t.scene.clampToHeightMostDetailed([e],i.objectsToExclude,.2).then((s=>{const a=s[0];if(u.defined(a)){const t=u.Cartographic.fromCartesian(a),e=t.height;if(u.defined(e)&&e>-1e3)return void(r&&r(e,t))}da(t,e,i)}));else{const e=t.scene.sampleHeight(s,i.objectsToExclude,.2);if(u.defined(e)&&e>-1e3)return r&&r(e,s),e}return 0}function da(t,e,i={}){const s=i.cartographic||u.Cartographic.fromCartesian(e),{callback:r}=i;if(!Boolean(t.scene.terrainProvider._layers))return r&&r(0,s),0;if(!i.async){const e=t.scene.globe.getHeight(s);return e&&e>-1e3?(r&&r(e,s),e):s.height}return Promise.all([u.sampleTerrainMostDetailed(t.scene.terrainProvider,[s])]).then((e=>{const i=e[0];let a;a=u.defined(i)&&u.defined(i.height)?i.height:t.scene.globe.getHeight(s),r&&r(a,s)})),0}function pa(t){const e=t.scene.canvas,i=new u.Cartesian2(e.clientWidth/2,e.clientHeight/2),s=t.scene.camera.getPickRay(i);if(s){let e=t.scene.globe.pick(s,t.scene);if(!e&&(e=t.scene.camera.pickEllipsoid(i)),e){return A.fromCartesian(e)}}}function ma(t,e,i){const s=t.scene;let r,a;try{a=s.pick(e,5,5)}catch(n){an("NOT_THROW","getCurrentMousePosition: scene.pick 拾取时异常",n)}if(s.pickPositionSupported&&u.defined(a)){const n=function(t,e){if(u.defined(t.id)){const i=t.id;if(i._noMousePick)return i;if(e&&i===e)return i}if(u.defined(t.primitive)){const i=t.primitive;if(i._noMousePick)return i;if(e&&i===e)return i}if(u.defined(t.tileset)){const i=t.tileset;if(i._noMousePick)return i;if(e&&i===e)return i}return}(a,null==i?void 0:i.noPickEntity);if(n){if(n.billboard||n.point||n.label)return Ma(n.position);if(n.show&&(n.show=!1,s.requestRender(),r=ma(t,e,i),n.show=!0,r))return r;if((null==i?void 0:i.onlyPickModelPosition)||!s.globe.show)return s.pickPosition(e)}else{if(u.defined(null==a?void 0:a.id)){const t=null==a?void 0:a.id;if((t.billboard||t.point||t.label)&&!t.model)return Ma(t.position)}if(r=s.pickPosition(e),u.defined(r)){const t=u.Cartographic.fromCartesian(r);if(t.height>=0)return r;if(!u.defined(null==a?void 0:a.id)&&t.height>=-5e3)return r}}}if(null==i?void 0:i.onlyPickModelPosition)return r;if(s.mode===u.SceneMode.SCENE3D){const t=s.camera.getPickRay(e);t&&(r=s.globe.pick(t,s),!r&&(r=s.camera.pickEllipsoid(e,s.globe.ellipsoid)))}else r=s.camera.pickEllipsoid(e,s.globe.ellipsoid);if(u.defined(r)&&s.camera.positionCartographic.height<1e4){if(u.Cartographic.fromCartesian(r).height<-5e3)return}return r}function fa(t,e=!1){for(let r=t.length-1;r>=0;r--)!u.defined(t[r])&&t.splice(r,1);const i=ne.toCartesians(t),s=u.Rectangle.fromCartesianArray(i);return e?_a(s):s}function _a(t,e=A.FormatLength){let i=E(u.Math.toDegrees(t.west),e),s=E(u.Math.toDegrees(t.east),e),r=E(u.Math.toDegrees(t.north),e),a=E(u.Math.toDegrees(t.south),e);return i>s&&([i,s]=[s,i]),a>r&&([a,r]=[r,a]),{xmin:i,xmax:s,ymin:a,ymax:r}}function ya(t){if(t instanceof u.Rectangle)return t;if(w(t))return u.Rectangle.fromDegrees(t[0],t[1],t[2],t[3]);if(C(t)){const e=t.split(",").map(Number.parseFloat);return u.Rectangle.fromDegrees(e[0],e[1],e[2],e[3])}return u.defined(t)&&u.defined(t.xmin)&&u.defined(t.xmax)&&u.defined(t.ymin)&&u.defined(t.ymax)?u.Rectangle.fromDegrees(t.xmin,t.ymin,t.xmax,t.ymax):void 0}function ga(t,e){if(!t||!e)return!1;const i=va(t),s=va(e);if(i==s)return!1;const r=i+"2"+s;return!!oa[r]&&oa[r]}function va(t){switch(t){case O.WGS84:return"wgs";case O.GCJ02:return"gcj";case O.BD09:return"bd"}}function Ma(t,e){if(!t)return;let i;return t instanceof u.Cartesian3?i=t:t._value instanceof u.Cartesian3?i=t._value:"function"==typeof t.getValue&&(i=t.getValue(u.JulianDate.now())),i}function Ca(t,e,i){return t?"string"==typeof t?u.Color.fromCssColorString(t):"function"==typeof t?Ca(t(i),e):t instanceof u.Property?Ca(t.getValue(u.JulianDate.now()),e):t:e||u.Color.WHITE}function xa(t,e,i=u.JulianDate.now()){if(!t)return t;if(e){if(t instanceof e)return t;if(t._value&&t._value instanceof e)return t._value}return x(t)?t.getValue(i):t}function ba(t,e){if(!t)return t;try{t.getValue&&(t=t.getValue(u.JulianDate.now()));const i={};if(t._propertyNames&&t._propertyNames.length>0)for(const s of t._propertyNames){const r=Sa(s,t[s],e);null!=r&&(i[s]=r)}else for(const s in t){const r=Sa(s,t[s],e);null!=r&&(i[s]=r)}return i}catch(i){an("NOT_THROW","getAttrVal: 出错了",i)}return t}function wa(t,e=u.Color.YELLOW){let i;return i=t.color?C(t.color)?u.Color.fromCssColorString(t.color):x(t.color)?t.color(t):t.color:t.randomColor?u.Color.fromRandom({minimumRed:u.defaultValue(t.minimumRed,0),maximumRed:u.defaultValue(t.maximumRed,.75),minimumGreen:u.defaultValue(t.minimumGreen,0),maximumGreen:u.defaultValue(t.maximumGreen,.75),minimumBlue:u.defaultValue(t.minimumBlue,0),maximumBlue:u.defaultValue(t.maximumBlue,.75)}):e,u.defined(i)?(u.defined(t.opacity)&&(t.opacity=Math.min(Math.max(t.opacity,0),1),i=i.withAlpha(Number(t.opacity))),i):i}function Pa(t,e={}){const i=u.writeTextToCanvas(t,e);if(i){if(e.outlineWidth){const t=i.width,s=i.height,r=i.getContext("2d");let a;a=e.outlineColor?e.outlineColor.toCssColorString():e.fillColor?e.fillColor.toCssColorString():"#ffffff";const n=e.outlineWidth;r.strokeStyle=a,r.lineWidth=n,r.strokeRect(n/2,n/2,t-n,s-n)}return i}return null}function Sa(t,e,i){if(null!=e&&""!==e&&"Null"!==e&&"Unknown"!==e&&(e.getValue&&"function"==typeof e.getValue&&"material"!=t&&(e=e.getValue(u.JulianDate.now())),!x(e))){if(i){if(e instanceof u.Color)return e.toCssColorString();if(!T(e))return}return e}}const Ta=Object.freeze(Object.defineProperty({__proto__:null,addPositionsHeight:function(t,e=0){if(e=Number(e),Number.isNaN(e)||0==e)return t;if(Array.isArray(t)){const i=[];for(let s=0,r=t.length;s<r;s++){const r=u.Cartographic.fromCartesian(t[s]),a=u.Cartesian3.fromRadians(r.longitude,r.latitude,r.height+e);i.push(a)}return i}{const i=u.Cartographic.fromCartesian(t);return u.Cartesian3.fromRadians(i.longitude,i.latitude,i.height+e)}},bd2gcj:Yr,bd2wgs:ea,cartesian2lonlat:Ar,cartesian2mercator:zr,cartesians2lonlats:Or,cartesians2mercators:Rr,degree2dms:Er,dms2degree:kr,formatRectangle:_a,gcj2bd:Qr,gcj2wgs:ta,get3DTilesetByPosition:ca,getAttrVal:ba,getCGCS2000EPSGByLng:Ir,getCGCS2000EPSGByX:Lr,getCanvasCenterCoords:pa,getCanvasXY:function(t,e){const i=A.toCartesian(e);return u.SceneTransforms.worldToWindowCoordinates(t.scene,i)},getCesiumColor:Ca,getCesiumValue:xa,getColorByStyle:wa,getCurrentMousePosition:ma,getRectangle:fa,getSurface3DTilesHeight:ua,getSurfaceHeight:ha,getSurfaceTerrainHeight:da,getTextImage:Pa,getTransFun:ga,jwd2mct:sa,lonlat2cartesian:Dr,lonlat2mercator:Gr,lonlats2cartesians:Nr,lonlats2mercators:Vr,mct2jwd:ra,mercator2cartesian:jr,mercator2lonlat:Wr,mercators2cartesians:Fr,mercators2lonlats:qr,parseRectangle:ya,proj4Trans:aa,proj4TransArr:na,setPositionsHeight:function(t,e=0){if(!t)return t;if(Array.isArray(t)){const i=[];for(let s=0,r=t.length;s<r;s++){const r=u.Cartographic.fromCartesian(t[s]),a=u.Cartesian3.fromRadians(r.longitude,r.latitude,e);i.push(a)}return i}{const i=u.Cartographic.fromCartesian(t);return u.Cartesian3.fromRadians(i.longitude,i.latitude,e)}},setRenderErrorHandler:la,wgs2bd:ia,wgs2gcj:$r},Symbol.toStringTag,{value:"Module"})),Ea=new u.Ray,ka=new u.Cartesian3;function Ia(t){return void 0!==t.alt&&void 0!==t.lat&&void 0!==t.lng}function La(t){return void 0!==t.xmax&&void 0!==t.xmin&&void 0!==t.ymin&&void 0!==t.ymax}function Aa(t){t.camera.cancelFlight()}function Oa(t,e){const i=Ia(e)?"LAT_LNG_ALT":La(e)?"EXTENT":0,s="LAT_LNG_ALT"===i?u.Cartesian3.fromDegrees(e.lng,e.lat,e.alt):"EXTENT"===i?u.Rectangle.fromDegrees(e.xmin,e.ymin,e.xmax,e.ymax):void 0;if(!s)return void an("NOT_THROW","flyTo: 方法参数传递有误，请检查");const r={heading:u.Math.toRadians(e.heading??0),pitch:u.Math.toRadians(e.pitch??-90),roll:e.roll??0};t.camera.flyTo({destination:s,orientation:r,...e})}function za(t,e,i={}){const s=A.parse(e),r=s.toCartesian();if(i.clampToGround)return void ha(t,r,{async:!0,has3dtiles:!0,callback:(e,r)=>{s.alt=e,delete i.clampToGround,za(t,s,i)}});let a=i.radius||Ga(t)||1e3;u.defined(i.scale)&&i.scale>0&&(a*=i.scale),u.defined(i.minHeight)&&a<i.minHeight&&(a=i.minHeight),u.defined(i.maxHeight)&&a>i.maxHeight&&(a=i.maxHeight);let n=u.defined(i.pitch)?u.Math.toRadians(i.pitch):t.camera.pitch;const o=u.Math.toDegrees(n);u.defined(i.minPitch)&&o<i.minPitch&&(n=u.Math.toRadians(i.minPitch)),u.defined(i.maxPitch)&&o>i.maxPitch&&(n=u.Math.toRadians(i.maxPitch));const l=u.defined(i.heading)?u.Math.toRadians(i.heading):t.camera.heading,h=new u.HeadingPitchRange(l,n,a),c=new u.BoundingSphere(r,0);0===i.duration?(t.camera.lookAt(r,h),i.complete&&i.complete()):t.camera.flyToBoundingSphere(c,{...i,offset:h})}function Ra(t,e,i={}){const s=e.xmin??0,r=e.xmax??0,a=e.ymin??0,n=e.ymax??0,o=(s+r)/2||m[0],l=(a+n)/2||m[1],h=u.Rectangle.fromDegrees(s,a,r,n),c=Math.min(Math.PI,Math.max(h.height,h.width)),d={...i};c>0&&(d.radius=u.defaultValue(d.radius,0)+u.Math.chordLength(c,t.scene.globe.ellipsoid.maximumRadius));let p=u.defaultValue(e.height,0);0==p&&(p=ha(t,u.Cartesian3.fromDegrees(o,l))),za(t,new A(o,l,p),d)}function Da(t,e,i={}){if(1==e.length)return void za(t,e[0],i);const s=fa(e,!0);s.height=Na(e),s&&(s.xmin==s.xmax||s.ymin==s.ymax||s.xmax-s.xmin>200?za(t,[s.xmin,s.ymin,s.height??0],i):Ra(t,s,i))}function Na(t,e=0){if(null==t||0==t.length)return e;let i=e;for(let s=0;s<t.length;s++){const e=u.Cartographic.fromCartesian(t[s]);0==s&&(i=e.height),e.height>i&&(i=e.height)}return E(i,A.FormatAltLength)}function Ga(t){const e=pa(t);if(e){return u.Cartesian3.distance(e.toCartesian(),t.camera.positionWC)}return 0}function Va(t,e){const i=t.camera.positionCartographic,s={},{FormatLength:r,FormatAltLength:a}=A;return s.lat=E(u.Math.toDegrees(i.latitude),r),s.lng=E(u.Math.toDegrees(i.longitude),r),e?(s.alt=E(i.height,0),s.heading=E(u.Math.toDegrees(t.camera.heading||0)%360,0),s.pitch=E(u.Math.toDegrees(t.camera.pitch||0)%360,0),s.roll=E(u.Math.toDegrees(t.camera.roll||0)%360,0)):(s.alt=E(i.height,a),s.heading=E(u.Math.toDegrees(t.camera.heading||0)%360,1),s.pitch=E(u.Math.toDegrees(t.camera.pitch||0)%360,1),s.roll=E(u.Math.toDegrees(t.camera.roll||0)%360,1)),s}function ja(t,e=A.FormatLength){const i=_a(u.Camera.DEFAULT_VIEW_RECTANGLE),s=t.scene.globe.ellipsoid,r=t.scene.canvas,a=t.camera.pickEllipsoid(new u.Cartesian2(0,0),s);if(a){const t=s.cartesianToCartographic(a);i.xmin=u.Math.toDegrees(t.longitude),i.ymax=u.Math.toDegrees(t.latitude)}else{const e=r.width/2,a=r.height/2;for(let r=0;r<=e;r+=10){const e=t.camera.pickEllipsoid(new u.Cartesian2(r,a),s);if(e){const t=s.cartesianToCartographic(e);i.xmin=u.Math.toDegrees(t.longitude);break}}for(let r=0;r<=a;r+=10){const a=t.camera.pickEllipsoid(new u.Cartesian2(e,r),s);if(a){const t=s.cartesianToCartographic(a);i.ymax=u.Math.toDegrees(t.latitude);break}}}const n=t.camera.pickEllipsoid(new u.Cartesian2(r.width,r.height),s);if(n){const t=s.cartesianToCartographic(n);i.xmax=u.Math.toDegrees(t.longitude),i.ymin=u.Math.toDegrees(t.latitude)}else{const e=r.width/2,a=r.height/2;for(let n=r.width;n>=e;n-=10){const e=t.camera.pickEllipsoid(new u.Cartesian2(n,a),s);if(e){const t=s.cartesianToCartographic(e);i.xmax=u.Math.toDegrees(t.longitude);break}}for(let n=r.height;n>=a;n-=10){const r=t.camera.pickEllipsoid(new u.Cartesian2(e,n),s);if(r){const t=s.cartesianToCartographic(r);i.ymin=u.Math.toDegrees(t.latitude);break}}}if(i.xmax<i.xmin){const t=i.xmax;i.xmax=i.xmin,i.xmin=t}if(i.ymax<i.ymin){const t=i.ymax;i.ymax=i.ymin,i.ymin=t}return _a(u.Rectangle.fromDegrees(i.xmin,i.ymin,i.xmax,i.ymax),e)}function Fa(t,e=1.5){return qa(t,e=1/e)}function Wa(t,e=1.5){return qa(t,e)}function qa(t,e){const i=t.scene,s=i.screenSpaceCameraController;if(!s.enableInputs||!s.enableZoom)return!1;const r=i.camera;let a;switch(i.mode){case u.SceneMode.MORPHING:return!1;case u.SceneMode.SCENE2D:return r.zoomIn(r.positionCartographic.height*(1-e)),!0;default:{let n;if(u.defined(t.trackedEntity)?n=new u.Cartesian3:(Ea.origin=r.positionWC,Ea.direction=r.directionWC,n=i.globe.pick(Ea,i,new u.Cartesian3),u.defined(n)&&(n=r.worldToCameraCoordinatesPoint(n,n))),u.defined(n))a={direction:r.direction,up:r.up};else{const t=new u.Ray(r.worldToCameraCoordinatesPoint(i.globe.ellipsoid.cartographicToCartesian(r.positionCartographic)),r.directionWC);if(n=u.IntersectionTests.grazingAltitudeLocation(t,i.globe.ellipsoid),!u.defined(n))return!1;a={heading:r.heading,pitch:r.pitch,roll:r.roll}}const o=u.Cartesian3.subtract(r.position,n,ka),l=u.Cartesian3.multiplyByScalar(o,e,o),h=u.Cartesian3.add(n,l,n);if(!u.defined(h))return!1;const c=s.minimumZoomDistance,d=s.maximumZoomDistance,p=u.Cartographic.fromCartesian(h).height;if(p<c)return!1;if(p<s.minimumCollisionTerrainHeight){const t=s._scene.globeHeight;if(u.defined(t)&&p<=t+c)return!1}return!(d&&p>d)&&(u.defined(t.trackedEntity)||i.mode==u.SceneMode.COLUMBUS_VIEW?r.position=h:r.flyTo({destination:h,orientation:a,duration:.5,convert:!1}),!0)}}}const Ba=Object.freeze(Object.defineProperty({__proto__:null,cancelFlyTo:Aa,flyTo:Oa,flyToExtent:Ra,flyToPoint:za,flyToPositions:Da,getCameraDistance:Ga,getCameraView:Va,getExtent:ja,getMaxHeight:Na,isCenter:Ia,isExtent:La,zoomIn:Fa,zoomOut:Wa},Symbol.toStringTag,{value:"Module"}));function Ha(t,e,i){let s,r;s=w(e)?e:[e],s.forEach((e=>{const s=F("button","cesium-button cesium-toolbar-button "+e.uuid);s.id="button_"+e.uuid,s.style.display="inline-block",s.setAttribute("title",e.title);const a=W(e.icon,!1)[0];a.classList.add("cesium-svgPath-svg"),s.appendChild(a),s.addEventListener("click",(i=>{var s;null==(s=e.onClick)||s.call(e,t)}));let n=document.getElementsByClassName("cesium-viewer-toolbar")[0];if((null==i?void 0:i.customContainer)&&(n=null==i?void 0:i.customContainer),M(null==i?void 0:i.insertIndex)){const t=n.childNodes;t.length<i.insertIndex&&(i.insertIndex=0),r?n.insertBefore(s,r):(n.insertBefore(s,t[i.insertIndex]),r=s)}else n.appendChild(s)}))}const Ua=Object.freeze(Object.defineProperty({__proto__:null,addButton:Ha,removeButton:function(t){var e;null==(e=document.querySelector("."+t))||e.remove()}},Symbol.toStringTag,{value:"Module"}));function Ka(t=2){const e=(3*Date.now()).toString(16),i=(new Date).getTimezoneOffset(),s=Number((i<0?"7":"6")+Math.abs(i)).toString(16),r=9*t+3+15;let a="";for(let n=0;n<t;n++)a+=Za()+"-";for(a+=s,a+=e;a.length<r;)a+=Za();return a.substring(0,r)}function Za(){return Number(Math.random().toString().substring(2)).toString(16).substring(0,8)}function Xa(t,e){if(t){if(Array.isArray(t)){const i=[];for(let s=0,r=t.length;s<r;s++)i.push(e(t[s]));return i}return e(t)}}function Ja(t,e,i){return Array.isArray(e)?Array.isArray(t)?function(t,e,i){const s=t.slice();return e.forEach(((e,r)=>{void 0===s[r]?s[r]=Ya(e,i):(S(e)||!t.includes(e))&&s.push(Ya(e,i))})),s}(t,e,i):Ya(e,i):function(t,e,i){const s={};return S(t)&&Object.keys(t).forEach((e=>{s[e]=Ya(t[e],i)})),Object.keys(e).forEach((r=>{S(e[r])&&t[r]?s[r]=Ja(t[r],e[r],i):s[r]=Ya(e[r],i)})),s}(t,e,i)}function Ya(t,e){return e&&!0===e.clone&&S(t)?Ja(function(t){return Array.isArray(t)?[]:{}}(t),t,e):t}class Qa extends G{constructor(t,e={}){super(e),n(this,"_viewer"),n(this,"_id"),n(this,"_direction"),n(this,"_enable"),n(this,"_handler"),n(this,"_container"),n(this,"_containerArrow"),n(this,"_containerContent"),n(this,"_currentWindowPosition"),n(this,"options"),this.options=e,this._viewer=t,this._id=u.defaultValue(e.id,this.uuid),this._direction=u.defaultValue(e.direction,"right"),this._enable=u.defaultValue(e.enable,!1),this._initContainer(),this._bindMousemoveEventHandler()}get id(){return this._id}get container(){return this._container}get viewerContainer(){var t;return null==(t=this._viewer)?void 0:t.container}get direction(){return this._direction}set direction(t){this._direction=t,this._setDivPosition()}get currentWindowPosition(){return this._currentWindowPosition}set currentWindowPosition(t){this._currentWindowPosition=t,this._setDivPosition()}get enable(){return this._enable}set enable(t){this._enable=t,this._container&&(this._container.style.display=this._enable?"block":"none")}_setDivPosition(){this._currentWindowPosition&&(this._container.style.display="block",this._container.style.top=this._currentWindowPosition.y-this._container.clientHeight/2+"px","right"==this.direction?(this._container.style.left=this._currentWindowPosition.x+25+"px",B(this._containerArrow,"pie3d-smallTooltip-rightArrow"),H(this._containerArrow,"pie3d-smallTooltip-leftArrow")):"left"==this.direction&&(this._container.style.left=this._currentWindowPosition.x-this._container.clientWidth-25+"px",B(this._containerArrow,"pie3d-smallTooltip-leftArrow"),H(this._containerArrow,"pie3d-smallTooltip-rightArrow")))}_initContainer(){this._container=F("div","pie3d-smallTooltip"),this._container.setAttribute("uuid",this.uuid),this._container.setAttribute("id","pie3d-smallTooltip-"+this.id),this._container.style.display="none",this._containerArrow=F("div","pie3d-smallTooltip-arrow pie3d-smallTooltip-rightArrow",this._container),this._containerContent=F("div","pie3d-smallTooltip-inner",this._container),this._container.addEventListener("click",(t=>{this.close()})),this.viewerContainer.appendChild(this._container)}_bindMousemoveEventHandler(){this._handler=new u.ScreenSpaceEventHandler(this._viewer.canvas),this._handler.setInputAction((t=>{const e=ma(this._viewer,t.endPosition);t.cartesian=e,this._mousemoveEventHandler(t)}),u.ScreenSpaceEventType.MOUSE_MOVE)}_unbindMousemoveEventHandler(){var t;null==(t=this._handler)||t.removeInputAction(u.ScreenSpaceEventType.MOUSE_MOVE)}_mousemoveEventHandler(t){this._enable&&(this.currentWindowPosition=u.SceneTransforms.worldToWindowCoordinates(this._viewer.scene,t.cartesian)??u.Cartesian2.ZERO)}open(t,e){if(!this._container&&this._initContainer(),t&&this._containerContent&&(this._containerContent.innerHTML=t),this._container.style.display="block",e instanceof u.Cartesian3)this.currentWindowPosition=u.SceneTransforms.worldToWindowCoordinates(this._viewer.scene,e)??u.Cartesian2.ZERO;else if(e instanceof u.Cartesian2){const t=new u.Cartesian3(e.x,e.y,0);this.currentWindowPosition=u.SceneTransforms.worldToWindowCoordinates(this._viewer.scene,t)??u.Cartesian2.ZERO}else this.currentWindowPosition=this.currentWindowPosition??u.Cartesian2.ZERO}close(){this._container&&(this._container.style.display="none")}destroy(){var t;this._container&&this._container.parentNode&&this.viewerContainer.removeChild(this._container),this._unbindMousemoveEventHandler(),null==(t=this._handler)||t.destroy(),super.destroy()}}const $a={id:"id",children:"children",pid:"pid"};function tn(t){return Object.assign({},$a,t)}function en(t,{children:e="children",conversion:i}){const s=Array.isArray(t[e])&&t[e].length>0,r=i(t)||{};return s?{...r,[e]:t[e].map((t=>en(t,{children:e,conversion:i})))}:{...r}}const sn=Object.freeze(Object.defineProperty({__proto__:null,BaseClass:G,LatLngPoint:A,Popup:U,SmallTooltip:Qa,addClass:B,camera:Ba,createDom:F,createSvg:function(t,e,i,s=null){const r=document.createElementNS("http://www.w3.org/2000/svg","svg");r.setAttribute("class","svg-path"),r.setAttribute("width",""+t),r.setAttribute("height",""+e),r.setAttribute("viewBox","0 0 "+t+" "+e);const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",i),r.appendChild(a),s&&s.appendChild(r),r},createVideo:function(t,e,i,s){const r=F("video",i,s);r.setAttribute("autoplay","true"),r.setAttribute("loop","true"),r.setAttribute("crossorigin","anonymous"),!e&&(e=t.substring(t.lastIndexOf(".")+1,t.length));const a=F("source","",r);return a.setAttribute("src",t),a.setAttribute("type","video/"+e),r},deepClone:j,deepMerge:Ja,deepMergeAll:function(t,e){if(!Array.isArray(t)||t.length<2)throw new Error("first argument should be an array with at least two elements");return t.reduce(((t,i)=>Ja(t,i,e)))},empty:function(t){for(;t.firstChild;)t.removeChild(t.firstChild)},enterFullscreen:function(t){if(!t)return!1;const e=t.requestFullscreen||t.msRequestFullscreen||t.mozRequestFullScreen||t.webkitRequestFullscreen;return!!e&&(e.call(t),!0)},exitFullscreen:function(){const t=["exitFullscreen","msExitFullscreen","mozCancelFullScreen","webkitExitFullscreen"];for(const e of t)if(document[e])return document[e](),!0;return!1},filterTree:function(t,e,i={}){const s=(i=tn(i)).children;return function t(i){return i.map((t=>({...t}))).filter((i=>(i[s]=i[s]&&t(i[s]),e(i)||i[s]&&i[s].length)))}(t)},findNode:function(t,e,i={}){i=tn(i);const{children:s}=i,r=[...t];for(const a of r){if(e(a))return a;a[s]&&r.push(...a[s])}},findNodeAll:function(t,e,i={}){i=tn(i);const{children:s}=i,r=[...t],a=[];for(const n of r)e(n)&&a.push(n),n[s]&&r.push(...n[s]);return a},findPath:function(t,e,i={}){i=tn(i);const s=[],r=[...t],a=new Set,{children:n}=i;for(;r.length;){const t=r[0];if(a.has(t))s.pop(),r.shift();else if(a.add(t),t[n]&&r.unshift(...t[n]),s.push(t),e(t))return s}return null},findPathAll:function(t,e,i={}){i=tn(i);const s=[],r=[...t],a=[],n=new Set,{children:o}=i;for(;r.length;){const t=r[0];n.has(t)?(s.pop(),r.shift()):(n.add(t),t[o]&&r.unshift(...t[o]),s.push(t),e(t)&&a.push([...s]))}return a},forEachTree:function(t,e,i={}){i=tn(i);const s=[...t],{children:r}=i;for(let a=0;a<s.length;a++){if(e(s[a]))return;r&&s[a][r]&&s.splice(a+1,0,...s[a][r])}},formatNum:E,get:function(t){return"string"==typeof t?document.getElementById(t):t},getClass:function(t){return t.correspondingElement&&(t=t.correspondingElement),t instanceof SVGElement?t.className.baseVal:t.className},getStyle:function(t,e){var i,s;let r=t.style[e]||(null==(i=window.getComputedStyle(t,null))?void 0:i.getPropertyValue(e))||null;return(!r||"auto"===r)&&(r=(null==(s=window.getComputedStyle(t,null))?void 0:s.getPropertyValue(e))||null),"auto"===r?null:r},guid:Ka,hasClass:q,isArray:w,isBoolean:b,isDark:function(){return window.matchMedia("(prefers-color-scheme: dark)").matches},isDate:function(t){return y(t,"Date")},isDef:g,isElement:P,isEmpty:function(t){return w(t)||C(t)?0===t.length:t instanceof Map||t instanceof Set?0===t.size:!!v(t)&&0===Object.keys(t).length},isFunction:x,isGuid:function(t,e=2){const i=t.split("-"),s=M(i[i.length-1]);return i.length-1!==e?"Invalid guid, invalid number of blocks":i.concat().slice(0,-1).reduce(((t,e)=>t&&8===e.length&&!e.includes(" ")),!0)?!(!s&&18!==i[i.length-1].length)||"Invalid guid, last date block has invalid size":"Invalid guid, one or more random blocks are invalid"},isImgPath:function(t){return/(https?:\/\/|data:image\/).*?\.(png|jpg|jpeg|gif|svg|webp|ico)/i.test(t)},isMap:function(t){return y(t,"Map")},isMergeableObject:S,isNumber:M,isObject:v,isPromise:function(t){return y(t,"Promise")&&v(t)&&x(t.then)&&x(t.catch)},isRegExp:function(t){return y(t,"RegExp")},isShortGuid:function(t){return 26!==t.length?"Should be 26 characters long":/^[a-z0-9]+$/i.test(t)?"":"Should be only alphanumeric"},isSimpleType:T,isString:C,isUnDef:function(t){return!g(t)},isUrl:function(t){return/^(http|https):\/\//.test(t)},isWindow:function(t){return"undefined"!=typeof window&&y(t,"Window")},layer:jt,listToTree:function(t,e={}){const i=tn(e),s=new Map,r=[],{id:a,children:n,pid:o}=i;for(const l of t)l[n]=l[n]||[],s.set(l[a],l);for(const l of t){const t=s.get(l[o]);(t?t.children:r).push(l)}return r},loopArrayCallback:Xa,map:Ta,material:st,parseDom:W,remove:function(t){const e="string"==typeof t?document.getElementById(t):t;if(!e)return;const i=e.parentNode;i&&i.removeChild(e)},removeClass:H,setClass:function(t,e){t instanceof SVGElement?t.className.baseVal=e:t.className=e},shortGuid:function(){return Ka(1).replace("-","")},template:I,treeMap:function(t,e){return t.map((t=>en(t,e)))},treeToList:function(t,e={}){e=tn(e);const{children:i}=e,s=[],r=t=>{for(const e of t)s.push(e),e[i]&&r(e[i])};return r(t),s},widget:Ua},Symbol.toStringTag,{value:"Module"}));function rn(t,e,i,...s){try{return s?i(...s):i()}catch(r){an(t,e,r)}}function an(t,e,i){const s=["[PIE3D warn]: “"+(w(e)?e[0]:e)+"”.",...w(e)?e.slice(1):[],null==i?void 0:i.message];if(console.warn(...s),"THROW"===t&&i)throw i}const nn={enabledMoveHandler:!0,moveDelay:30,pickWidth:4,pickHeight:4,pickLimit:9};class on{constructor(t,e={enabledMoveHandler:!0,moveDelay:30,pickWidth:4,pickHeight:4,pickLimit:9}){n(this,"earth"),n(this,"viewer"),n(this,"options"),n(this,"handler"),n(this,"_enabledMoveHandler"),n(this,"_lastPickedInfo"),n(this,"_moveDelayTik"),n(this,"_lastMouseOverItem"),e={...nn,...e},this.earth=t,this.viewer=t.viewer,this.options=e,this._enabledMoveHandler=Boolean(e.enabledMoveHandler),this._setInputAction()}get enabledMoveHandler(){return this._enabledMoveHandler}set enabledMoveHandler(t){this._enabledMoveHandler=t,this._moveDelayTik&&(clearTimeout(this._moveDelayTik),this._moveDelayTik=void 0)}_setInputAction(){this.handler=new u.ScreenSpaceEventHandler(this.viewer.canvas),this.handler.setInputAction((t=>{this._clickHandler(t)}),u.ScreenSpaceEventType.LEFT_CLICK),this.handler.setInputAction((t=>{this.earth.emit(D.dblClick,t)}),u.ScreenSpaceEventType.LEFT_DOUBLE_CLICK),this.handler.setInputAction((t=>{this._globeMouseHandler(t,[D.leftDown,D.mouseDown])}),u.ScreenSpaceEventType.LEFT_DOWN),this.handler.setInputAction((t=>{this._globeMouseHandler(t,[D.leftUp,D.mouseUp])}),u.ScreenSpaceEventType.LEFT_UP),this.handler.setInputAction((t=>{const e=ma(this.viewer,t.endPosition);t.cartesian=e,this._enabledMoveHandler&&(this._moveDelayTik&&(clearTimeout(this._moveDelayTik),this._moveDelayTik=void 0),void 0!==this.options.moveDelay&&this.options.moveDelay>0?this._moveDelayTik=setTimeout((e=>{this._moveDelayTik=void 0,this._mouseMoveHandler(t)}),this.options.moveDelay):this._mouseMoveHandler(t)),this.earth.emit(D.mouseMove,{...t,cartesian:e,windowPosition:t.endPosition})}),u.ScreenSpaceEventType.MOUSE_MOVE),this.handler.setInputAction((t=>{this.earth.emit(D.wheel,t)}),u.ScreenSpaceEventType.WHEEL),this.handler.setInputAction((t=>{this._globeMouseHandler(t,D.rightClick)}),u.ScreenSpaceEventType.RIGHT_CLICK),this.handler.setInputAction((t=>{this._globeMouseHandler(t,[D.rightDown,D.mouseDown])}),u.ScreenSpaceEventType.RIGHT_DOWN),this.handler.setInputAction((t=>{this._globeMouseHandler(t,[D.rightUp,D.mouseUp])}),u.ScreenSpaceEventType.RIGHT_UP),this.handler.setInputAction((t=>{this._globeMouseHandler(t,D.middleClick)}),u.ScreenSpaceEventType.MIDDLE_CLICK),this.handler.setInputAction((t=>{this._globeMouseHandler(t,[D.middleDown,D.mouseDown])}),u.ScreenSpaceEventType.MIDDLE_DOWN),this.handler.setInputAction((t=>{this._globeMouseHandler(t,[D.middleUp,D.mouseUp])}),u.ScreenSpaceEventType.MIDDLE_UP),this.handler.setInputAction((t=>{this._globeMouseHandler(t,D.pinchStart)}),u.ScreenSpaceEventType.PINCH_START),this.handler.setInputAction((t=>{this._globeMouseHandler(t,D.pinchEnd)}),u.ScreenSpaceEventType.PINCH_END),this.handler.setInputAction((t=>{this.earth.emit(D.pinchMove,t)}),u.ScreenSpaceEventType.PINCH_MOVE),this.viewer.canvas.addEventListener("keydown",this._onKeyDown.bind(this)),this.viewer.canvas.addEventListener("keyup",this._onKeyUp.bind(this))}_onKeyDown(t){this.earth.emit(D.keydown,{ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey,code:t.code,key:t.key,keyCode:t.keyCode})}_onKeyUp(t){this.earth.emit(D.keyup,{ctrlKey:t.ctrlKey,altKey:t.altKey,metaKey:t.metaKey,shiftKey:t.shiftKey,code:t.code,key:t.key,keyCode:t.keyCode})}_clickHandler(t){if(!t||!t.position)return!1;const e=t.position,i=this._getPickTarget(e,t);i.sourceTarget?(this._fireTargetEvent(D.click,i),this.earth.emit(D.clickGraphic,i)):(this.earth.emit(D.click,i),this.earth.emit(D.clickMap,i),this._getPickImageryLayerFeatures(e,i))}_globeMouseHandler(t,e){if(!t||!t.position)return!1;const i=t.position,s=this._getPickTarget(i,t);Array.isArray(e)?e.forEach((t=>{s.sourceTarget?this._fireTargetEvent(t,s):this.earth.emit(t,s)})):s.sourceTarget?this._fireTargetEvent(e,s):this.earth.emit(e,s)}_mouseMoveHandler(t){if(!t||!t.endPosition)return!1;const e=this._getPickTarget(t.endPosition,t),i=e.sourceTarget;i&&!i.noMouseMove?this._activateMouseOver(e):this._activateMouseOut(),this.earth.emit(D.mouseMoveTarget,{...t,...e})}_getPickTarget(t,e){let i;try{i=this.viewer.scene.pick(t,this.options.pickWidth,this.options.pickHeight)}catch(a){}let s=null==e?void 0:e.cartesian;if(!s&&(s=ma(this.viewer,t)),this._lastPickedInfo&&i&&this._lastPickedInfo.pickedObject===i)return{...e,...this._lastPickedInfo,cartesian:s,windowPosition:t};let r=this._getTargetInfo(i);if(i&&this._allowDrillPick(r)){const e=this.viewer.scene.drillPick(t,this.options.pickLimit,this.options.pickWidth,this.options.pickHeight);if(e&&e.length>0)for(let t=0;t<e.length;t++){const s=e[t];if(i===s)continue;const a=this._getTargetInfo(s);if(!this._allowDrillPick(a)){r=a;break}}}return this._lastPickedInfo=r,{...e,...r,cartesian:s,windowPosition:t}}_getTargetInfo(t){if(!u.defined(t))return{};let e,i,s;if(t instanceof u.Cesium3DTileFeature){e=t;const r=t.tileset;i=this.earth.getLayerById(r._pie3d_layerId);const a={},n=t.getPropertyIds();for(let e=0;e<n.length;e++){const i=n[e];if(!t.hasProperty(i))continue;const s=t.getProperty(i);null!=s&&(a[i]=s)}s={attr:a,feature:t}}else u.defined(t.primitive)?e=t.primitive:console.log("_getPickTarget: 拾取到了对象，请确认是否要做处理",t);return e&&(i=i||this.earth.getLayerById(e._pie3d_layerId)),{pickedObject:t,sourceTarget:e,layer:i,picked3DTileFeature:s}}_getPickImageryLayerFeatures(t,e){const i=this.viewer.scene,s=i.camera.getPickRay(t);if(!s)return;const r=i.imageryLayers.pickImageryLayerFeatures(s,i);u.defined(r)&&Promise.resolve(r).then((i=>{this._clickTileGraphicHandler(i,t,e)})).catch((t=>{an("NOT_THROW","pickImageryLayerFeatures:出错了")}))}_clickTileGraphicHandler(t,e,i){if(!u.defined(t)||0==t.length)return;const s=t[0],r=s.imageryLayer,a=this.earth.getLayerById(r._pie3d_layerId),n={sourceTarget:r,layer:a,pickedFeature:s,features:t,cartesian:null==i?void 0:i.cartesian,windowPosition:e};a&&a.emit(D.click,n,!1),this.earth.emit(D.clickTileGraphic,n)}_allowDrillPick(t){var e;const i=null==(e=t.layer)?void 0:e.allowDrillPick;return!!i&&(!x(i)||i(t))}_activateMouseOver(t){this._lastMouseOverItem&&t.id&&t.id==this._lastMouseOverItem.id||(this._activateMouseOut(),this._fireTargetEvent(D.mouseOver,t),this._lastMouseOverItem=t)}_activateMouseOut(){null!=this._lastMouseOverItem&&(this._fireTargetEvent(D.mouseOut,this._lastMouseOverItem),this._lastMouseOverItem=null)}_fireTargetEvent(t,e){var i;const s=e.sourceTarget[t];s&&"function"==typeof s?s(e):(null==(i=e.layer)?void 0:i.emit)?e.layer.emit(t,e,!0):this.earth.emit(t,e)}destroy(){var t;null==(t=this.handler)||t.destroy(),delete this.handler,this.viewer.canvas.removeEventListener("keydown",this._onKeyDown),this.viewer.canvas.removeEventListener("keyup",this._onKeyUp)}}class ln{constructor(t){n(this,"viewer"),this.viewer=t}on(t,e,i){if(!e)return;let s;switch(t){case D.cameraMoveStart:s=this.viewer.camera.moveStart.addEventListener(e,i||this);break;case D.cameraMoveEnd:s=this.viewer.camera.moveEnd.addEventListener(e,i||this);break;case D.cameraChanged:s=this.viewer.camera.changed.addEventListener(e,i||this);break;case D.preUpdate:s=this.viewer.scene.preUpdate.addEventListener(e,i||this);break;case D.postUpdate:s=this.viewer.scene.postUpdate.addEventListener(e,i||this);break;case D.preRender:s=this.viewer.scene.preRender.addEventListener(e,i||this);break;case D.postRender:s=this.viewer.scene.postRender.addEventListener(e,i||this);break;case D.renderError:s=this.viewer.scene.renderError.addEventListener(e,i||this);break;case D.morphStart:s=this.viewer.scene.morphStart.addEventListener(e,i||this);break;case D.morphComplete:s=this.viewer.scene.morphComplete.addEventListener(e,i||this);break;case D.clockTick:s=this.viewer.clock.onTick.addEventListener(e,i||this);break;case D.terrainChange:s=this.viewer.scene.globe.terrainProviderChanged.addEventListener(e,i||this);break;case D.tileLoadProgress:s=this.viewer.scene.globe.tileLoadProgressEvent.addEventListener(e,i||this)}return s}off(t,e,i){let s=!1;switch(t){case D.cameraMoveStart:s=this.viewer.camera.moveStart.removeEventListener(e,i||this);break;case D.cameraMoveEnd:s=this.viewer.camera.moveEnd.removeEventListener(e,i||this);break;case D.cameraChanged:s=this.viewer.camera.changed.removeEventListener(e,i||this);break;case D.preUpdate:s=this.viewer.scene.preUpdate.removeEventListener(e,i||this);break;case D.postUpdate:s=this.viewer.scene.postUpdate.removeEventListener(e,i||this);break;case D.preRender:s=this.viewer.scene.preRender.removeEventListener(e,i||this);break;case D.postRender:s=this.viewer.scene.postRender.removeEventListener(e,i||this);break;case D.renderError:s=this.viewer.scene.renderError.removeEventListener(e,i||this);break;case D.morphStart:s=this.viewer.scene.morphStart.removeEventListener(e,i||this);break;case D.morphComplete:s=this.viewer.scene.morphComplete.removeEventListener(e,i||this);break;case D.clockTick:s=this.viewer.clock.onTick.removeEventListener(e,i||this);break;case D.terrainChange:s=this.viewer.scene.globe.terrainProviderChanged.removeEventListener(e,i||this);break;case D.tileLoadProgress:s=this.viewer.scene.globe.tileLoadProgressEvent.removeEventListener(e,i||this)}return s}}const hn=[{uuid:"cesium-zoomout-button",title:"缩小",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24"><path d="M19 13H5v-2h14z"/></svg>',onClick:t=>Wa(t)},{uuid:"cesium-zoomin-button",title:"放大",icon:'<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"/></svg>',onClick:t=>Fa(t)}];u.Ion.defaultAccessToken=p,u.Camera.DEFAULT_VIEW_RECTANGLE=u.Rectangle.fromDegrees(41.728921,-26.042904,174.271087,86.861514);const cn=class t extends G{constructor(e,i,s){var r;super({viewerOptions:i,earthOptions:s}),n(this,"viewerOptions"),n(this,"earthOptions"),n(this,"viewer"),n(this,"_layerIdx",1),n(this,"_arrLayerIdx",[]),n(this,"_layerCache"),n(this,"_sceneEvent"),n(this,"_mouseEvent"),n(this,"_chinaCRS"),n(this,"smallTooltip"),this.viewerOptions={...this.originOptions.viewerOptions},this.earthOptions={...this.originOptions.earthOptions},this.setToken(null==s?void 0:s.token),this.viewer=this._createViewer(e,i,s),this.viewer.container.classList.add("pie3d-cesium-container"),t.EarthCache.set(this.uuid,this),this._chinaCRS=(null==(r=this.earthOptions)?void 0:r.chinaCRS)??O.WGS84,(null==s?void 0:s.zoomButton)&&Ha(this.viewer,hn),(null==s?void 0:s.homeVision)&&Oa(this.viewer,s.homeVision),this._layerCache={},this._layerIdx=0,this._sceneEvent=new ln(this.viewer),this._mouseEvent=new on(this),this.smallTooltip=new Qa(this.viewer),this._initLayers()}static getInstance(e){return t.EarthCache.get(e)}_createViewer(t,e,i){return rn("THROW","Earth.constructor",(()=>{let i;if(C(t)){const e=t.replace(/^#/,""),i=document.getElementById(e);if(!i)throw new TypeError('Element with id "'+t+'" does not exist in the document.');t=i}if(P(t)||t instanceof u.Viewer)return i=P(t)?new u.Viewer(t,e):t,i;throw new TypeError("the view param is not in 【string | Element | Cesium.Viewer】")}))}destroy(){t.EarthCache.delete(this.uuid),this.viewer.destroy(),super.destroy()}get imageryLayers(){return this.viewer.imageryLayers}get imageryLayersArr(){return Array.from({length:this.viewer.imageryLayers.length??0}).map(((t,e)=>this.viewer.imageryLayers.get(e)))}get dataSources(){return this.viewer.dataSources}get entities(){return this.viewer.entities}get hasTerrain(){return!(this.viewer.terrainProvider instanceof u.EllipsoidTerrainProvider)}setRenderErrorHandler(t){la(this.viewer,t)}setToken(t){u.Ion.defaultAccessToken=(null==t?void 0:t.ion)??p}cancelFlyTo(){Aa(this.viewer)}flyHome(t){var e,i;(null==(e=this.earthOptions)?void 0:e.homeVision)&&Oa(this.viewer,{...null==(i=this.earthOptions)?void 0:i.homeVision,...t})}flyTo(t){Oa(this.viewer,t)}flyToPoint(t,e={}){za(this.viewer,t,e)}flyToExtent(t,e={}){Ra(this.viewer,t,e)}flyToPositions(t,e={}){Da(this.viewer,t,e)}getCameraView(t){return Va(this.viewer,t)}getExtent(t=A.FormatLength){return ja(this.viewer,t)}_initLayers(){var t,e,i;this._layerIdx=1,this._arrLayerIdx=[];const s=null==(t=this.earthOptions)?void 0:t.layers,r=[];null==s||s.forEach(((t,e)=>{void 0!==t.id?this._arrLayerIdx.push(t.id):t.id=this._getNextLayerId();const i=Gt(t);if(i&&(t.show&&this.addLayer(i),r.push(t),i.hasChildLayer&&t.layers))for(let s=0;s<t.layers.length;s++){const e=t.layers[s];e.pid=t.id,e.parent=i,!e.id&&(e.id=this._getNextLayerId()),r.push(e)}}));for(let a=0;a<r.length;a++){const t=r[a];let s=Number(t.zIndex);Number.isNaN(s)&&(s=a),t.zIndex=s,this._layerCache[t.id]&&Reflect.has(this._layerCache[t.id],"setZIndex")&&(null==(i=(e=this._layerCache[t.id]).setZIndex)||i.call(e,s))}}_getNextLayerId(){for(;this._arrLayerIdx.includes(this._layerIdx);)this._layerIdx++;return this._arrLayerIdx.push(this._layerIdx),this._layerIdx}getLayerById(t){if(u.defined(this._layerCache[t]))return this._layerCache[t];const e=this.getLayers();for(let i=0,s=e.length;i<s;i++){const s=e[i];if(s.uuid==t||s.id==t)return s;if(s.hasChildLayer&&s.arrLayer)for(let e=0;e<s.arrLayer.length;e++){const i=s.arrLayer[e];if(i.uuid==t||i.id==t)return i}}}getLayerByAttr(t,e="id"){if(u.defined(this._layerCache[t]))return this._layerCache[t];const i=this.getLayers();for(let s=0,r=i.length;s<r;s++){const r=i[s];if(r.options[e]==t)return r}}getLayers(){const t=[];return Object.keys(this._layerCache).forEach((e=>{const i=this._layerCache[e];i.options.isInternal||t.push(i)})),t}getTileLayers(){const t=[];return Object.keys(this._layerCache).forEach((e=>{const i=this._layerCache[e];i.isTile&&!i.options.isInternal&&t.push(i)})),t}eachLayer(t,e){Object.keys(this._layerCache).forEach(((i,s)=>{const r=this._layerCache[i];t.call(e,r,s)}))}addLayer(t,e){u.defined(e)&&(t.show=e),t.state!==N.ADDED&&(t._onAdd(this),t.id&&this._layerCache[t.id]&&this._layerCache[t.id]!==t&&(t.options.id=this._getNextLayerId(),an("NOT_THROW",["addLayer: 图层id存在冲突，已重新赋值id",t])),t.id&&(this._layerCache[t.id]=t))}removeLayer(t,e=!0){(!C(t)&&!M(t)||(t=this._layerCache[t]))&&t.state===N.ADDED&&(t.id&&delete this._layerCache[t.id],t._onRemove(),e&&t.destroy())}on(t,e,i){let s;return"string"==typeof t&&(s=this._sceneEvent.on(t,e,i||this)),!s&&super.on(t,e,i),this}off(t,e,i){return!this._sceneEvent.off(t,e,i||this)&&super.off(t,e,i),this}};n(cn,"EarthCache",new Map);let un=cn;class dn{constructor(t={}){n(this,"options"),this.options=t}static getColorByStyle(t){return(new dn).getColorByStyle(t)}get excludedKeys(){return[]}get exportKeys(){return["label","outlineStyle","highlight"]}_toCesiumValBefore(t,e){}_toCesiumValEnd(t,e){}_toOneCesiumVal(t,e,i,s){s[t]=e}_toOneJson(t,e,i){}toCesiumVal(t,e={}){this._toCesiumValBefore(t,e);for(const i in t){const s=t[i];if(!T(s)){e[i]=s;continue}if(this.excludedKeys&&this.excludedKeys.includes(i))continue;const r=this._toOneCesiumVal(i,s,t,e);null!=r&&(e[i]=r)}return this._toCesiumValEnd(t,e),e}toJSON(t,e={}){t=ba(t);for(const i in t){const s=t[i];T(s)?e[i]=s:this.exportKeys&&this.exportKeys.includes(i)?e[i]=ba(s):this._toOneJson(i,t[i],e)}return e}getColorByStyle(t){return wa(t,this.options.color)}getOutlineColorByStyle(t){let e;return e=t.outlineColor?C(t.outlineColor)?u.Color.fromCssColorString(t.outlineColor):t.outlineColor:this.options.outlineColor,e?(u.defined(t.outlineOpacity)?e=e.withAlpha(Number(t.outlineOpacity)):u.defined(t.opacity)&&(e=e.withAlpha(Number(t.opacity))),e):e}}class pn extends dn{static toCesiumVal(t,e={}){return!this.baseMaterialConver&&(this.baseMaterialConver=new pn),this.baseMaterialConver.toCesiumVal(t,e)}static toJSON(t,e={}){return(new pn).toJSON(t,e)}get excludedKeys(){return["label"].concat(this._getExcludedStyle())}_toOneCesiumVal(t,e,i,s){switch(t){case"color":case"randomColor":s.color=this.getColorByStyle(i);break;case"color2":case"evenColor":case"outlineColor":case"oddColor":case"baseWaterColor":case"blendColor":case"gapColor":case"strokeColor":case"backgroundColor":case"asphaltColor":case"lightColor":case"darkColor":case"grassColor":case"dirtColor":case"lightWoodColor":case"darkWoodColor":s[t]=Ca(e);break;case"repeat_x":case"repeat_y":{const t=u.defaultValue(i.repeat_x,1),e=u.defaultValue(i.repeat_y,1);s.repeat=new u.Cartesian2(t,e);break}case"repeat":i.materialType==se.Stripe||i.materialType==se.CylinderWave?s[t]=e:s[t]=new u.Cartesian2(i.repeat_x||e,i.repeat_y||e);break;case"lineCount":case"lineThickness":case"lineOffset":case"noiseScale":s[t]=new u.Cartesian2(e,e);break;default:s[t]=e}}_toOneJson(t,e,i){if(e instanceof u.Color)i[t]=e.toCssColorString();else switch(t){case"label":break;case"color":case"evenColor":case"outlineColor":case"oddColor":case"baseWaterColor":case"blendColor":case"gapColor":case"strokeColor":case"backgroundColor":case"asphaltColor":case"lightColor":case"darkColor":case"grassColor":case"dirtColor":case"lightWoodColor":case"darkWoodColor":{const s=xa(e,u.Color);s&&(i[t]=s.toCssColorString());break}case"repeat":e instanceof u.Cartesian2?e.x!=e.y?(i[t+"_x"]=e.x,i[t+"_y"]=e.y):i[t]=e.x:i[t]=e;break;case"lineCount":case"lineThickness":case"lineOffset":case"noiseScale":i[t+"_x"]=e.x,i[t+"_y"]=e.y;break;default:console.log("未处理的属性",t,e)}}_getExcludedStyle(){return[]}toJSON(t,e={}){if(t.options){const e=t.options;for(const i in e)u.defined(t[i])&&(e[i]=t[i]);t=e}return super.toJSON(t,e)}}class mn extends dn{constructor(){super(...arguments),n(this,"isEntity")}get excludedKeys(){return["label","outlineOpacity","outlineStyle","lineCount","lineThickness","cellAlpha","oddcolor","speed","axisY","image2","color2","scaleByDistance_near","scaleByDistance_nearValue","scaleByDistance_far","scaleByDistance_farValue","distanceDisplayCondition_far","distanceDisplayCondition_near"].concat(this._getExcludedStyle())}_toCesiumValBefore(t,e){t.material||t.materialType||(t.color||t.randomColor?t.materialType=se.Color:t.image&&(t.materialType=se.Image))}_getExcludedStyle(){return[]}_toOneCesiumVal_Point(t,e,i,s){switch(t){case"clampToGround":s.heightReference=e?u.HeightReference.CLAMP_TO_GROUND:u.HeightReference.NONE;break;case"visibleDepth":s.disableDepthTestDistance=e?0:Number.POSITIVE_INFINITY;break;case"scaleByDistance":s.scaleByDistance=e?new u.NearFarScalar(Number(u.defaultValue(i.scaleByDistance_near,1e3)),Number(u.defaultValue(i.scaleByDistance_nearValue,1)),Number(u.defaultValue(i.scaleByDistance_far,1e6)),Number(u.defaultValue(i.scaleByDistance_farValue,.1))):void 0;break;case"distanceDisplayCondition":s.distanceDisplayCondition=e?new u.DistanceDisplayCondition(Number(u.defaultValue(i.distanceDisplayCondition_near,0)),Number(u.defaultValue(i.distanceDisplayCondition_far,1e5))):void 0;break;default:s[t]=e}}_toOneCesiumVal_Poly(t,e,i,s){switch(t){case"materialType":this.isEntity?s.material=et(i.materialType,i):s.material=tt(i.materialType,i);break;case"color":case"randomColor":s.color=this.getColorByStyle(i);break;case"outlineColor":s.outlineColor=this.getOutlineColorByStyle(i);break;case"hasShadows":s.shadows=e?u.ShadowMode.ENABLED:u.ShadowMode.DISABLED;break;case"distanceDisplayCondition":e?this.isEntity?s.distanceDisplayCondition=new u.DistanceDisplayCondition(Number(u.defaultValue(i.distanceDisplayCondition_near,0)),Number(u.defaultValue(i.distanceDisplayCondition_far,1e5))):s.distanceDisplayCondition=new u.DistanceDisplayConditionGeometryInstanceAttribute(Number(u.defaultValue(i.distanceDisplayCondition_near,0)),Number(u.defaultValue(i.distanceDisplayCondition_far,1e5))):s.distanceDisplayCondition=void 0;break;default:s[t]instanceof u.CallbackProperty||(s[t]=e)}}_toOneJson_Poly(t,e,i){switch(t){case"label":break;case"material":it(e,i);break;case"color":{const s=xa(e,u.Color);s&&(i[t]=s.toCssColorString());break}case"outlineColor":{const s=xa(e,u.Color);s&&(i[t]=s.toCssColorString());break}case"shadows":e==u.ShadowMode.ENABLED?i.shadows=!0:i[t]=e;break;case"distanceDisplayCondition":i.distanceDisplayCondition_near=e.near,i.distanceDisplayCondition_far=e.far;break;default:console.log("未处理的属性",e)}}_toOneJson_Point(t,e,i){switch(t){case"label":break;case"color":{const t=xa(e,u.Color);t&&(i.color=t.toCssColorString());break}case"heightReference":e==u.HeightReference.CLAMP_TO_GROUND&&(i.clampToGround=!0);break;case"disableDepthTestDistance":e===Number.POSITIVE_INFINITY?i.visibleDepth=!1:i.disableDepthTestDistance=e;break;case"scaleByDistance":i.scaleByDistance=!0,i.scaleByDistance_near=e.near,i.scaleByDistance_nearValue=e.nearValue,i.scaleByDistance_far=e.far,i.scaleByDistance_farValue=e.farValue;break;case"distanceDisplayCondition":i.distanceDisplayCondition=!0,i.distanceDisplayCondition_near=e.near,i.distanceDisplayCondition_far=e.far;break;default:console.log("未处理的属性",e)}}}class fn extends pn{static toCesiumVal(t,e={},i){return t instanceof u.Color?t:(!this.colorOptsConver&&(this.colorOptsConver=new fn),this.colorOptsConver.isProperty=i,this.colorOptsConver.toCesiumVal(t,e))}static toJSON(t,e,i){return!this.colorOptsConver&&(this.colorOptsConver=new fn),this.colorOptsConver.isProperty=i,this.colorOptsConver.toJSON(t,e)}toCesiumVal(t){return this.isProperty?this.getColorByStyle(t):{color:this.getColorByStyle(t)}}toJSON(t,e={}){let i=xa(t,u.Color);return i.color&&(i=i.color),e.color=i.toCssColorString(),e}}class _n extends pn{get excludedKeys(){return["repeat_y"]}static toCesiumVal(t,e={}){return!this.imageOptsConver&&(this.imageOptsConver=new _n),this.imageOptsConver.toCesiumVal(t,e)}static toJSON(t,e){return!this.imageOptsConver&&(this.imageOptsConver=new _n),this.imageOptsConver.toJSON(t,e)}_toOneCesiumVal(t,e,i,s){switch(t){case"repeat_x":{const t=u.defaultValue(i.repeat_x,1),e=u.defaultValue(i.repeat_y,1);s.repeat=new u.Cartesian2(t,e);break}case"repeat":s[t]=new u.Cartesian2(i.repeat_x||e,i.repeat_y||e);break;case"color":break;case"opacity":s.color=u.Color.WHITE.withAlpha(i.opacity);break;default:s[t]=e}}_toCesiumValEnd(t,e){e.transparent=u.defaultValue(e.transparent,!0)}_toOneJson(t,e,i){var s;switch(t){case"repeat":i.repeat_x=e.x,i.repeat_y=e.y;break;case"color":i.opacity=(null==(s=xa(e,u.Color))?void 0:s.alpha)??1;break;default:console.log("未处理的属性",t,e)}}}class yn extends mn{static toCesiumVal(t,e={},i){return!this.labelStyleConver&&(this.labelStyleConver=new yn),this.labelStyleConver.attr=i,e=this.labelStyleConver.toCesiumVal(t,e)}static toJSON(t,e){return(new yn).toJSON(t,e)}_toCesiumValBefore(t,e){e.horizontalOrigin=u.defaultValue(e.horizontalOrigin,u.HorizontalOrigin.CENTER),e.verticalOrigin=u.defaultValue(e.verticalOrigin,u.VerticalOrigin.BOTTOM)}_toCesiumValEnd(t,e){if(!u.defined(t.font)){const i=t.font_size||18;e.font=(t.font_style||"normal")+" small-caps "+(t.font_weight||"normal")+" "+i+"px "+(t.font_family||"楷体")}!u.defined(t.style)&&u.defaultValue(t.fill,!0)&&(t.outline?e.style=u.LabelStyle.FILL_AND_OUTLINE:e.style=u.LabelStyle.FILL)}_getExcludedStyle(){return["font_style","font_weight","font_size","font_family","backgroundOpacity","fill","outline"]}_toOneCesiumVal(t,e,i,s){switch(t){case"text":this.attr&&(e=I(e,this.attr,!0)),s.text=e.replace(new RegExp("<br />","g"),"\n");break;case"color":s.fillColor=this.getColorByStyle(i);break;case"outlineColor":s.outlineColor=this.getOutlineColorByStyle(i);break;case"strokeColor":case"fillColor":s[t]=Ca(e);break;case"background":s.showBackground=e;break;case"backgroundColor":{let t=u.Color.fromCssColorString(e||"#000000");u.defined(i.backgroundOpacity)?t=t.withAlpha(Number(i.backgroundOpacity)):u.defined(i.opacity)&&(t=t.withAlpha(Number(i.opacity))),s.backgroundColor=t;break}case"backgroundPadding":s.backgroundPadding=new u.Cartesian2(1.2*e,e);break;case"hasPixelOffset":!e&&(s.pixelOffset=new u.Cartesian2(0,0));break;case"pixelOffsetX":case"pixelOffsetY":s.pixelOffset=new u.Cartesian2(i.pixelOffsetX||0,i.pixelOffsetY||0);break;case"pixelOffset":u.defined(e[0])&&u.defined(e[1])?s.pixelOffset=new u.Cartesian2(e[0],e[1]):s.pixelOffset=e;break;default:this._toOneCesiumVal_Point(t,e,i,s)}}_toOneJson(t,e,i){switch(t){case"pixelOffset":i.pixelOffsetX=e.x,i.pixelOffsetY=e.y;break;case"disableDepthTestDistance":e===Number.POSITIVE_INFINITY?i.visibleDepth=!1:i.disableDepthTestDistance=e;break;default:this._toOneJson_Point(t,e,i)}}}class gn extends mn{static toCesiumVal(t,e,i){return!this.polylineStyleConver&&(this.polylineStyleConver=new gn),this.polylineStyleConver.isEntity=i,this.polylineStyleConver.toCesiumVal(t,e)}static toJSON(t,e,i){return!this.polylineStyleConver&&(this.polylineStyleConver=new gn),this.polylineStyleConver.isEntity=i,this.polylineStyleConver.toJSON(t,e)}_toCesiumValBefore(t,e){super._toCesiumValBefore(t,e),t.clampToGround&&(e.arcType=u.ArcType.GEODESIC),t.materialType==se.Color&&t.outline&&t.outlineColor&&(t.materialType=se.PolylineOutline)}_toOneCesiumVal(t,e,i,s){switch(t){case"depthFail":e?(s.depthFailMaterial=u.Color.fromCssColorString(i.depthFailColor||"#FFFF00").withAlpha(Number(u.defaultValue(i.depthFailOpacity,u.defaultValue(i.opacity,.9)))),1==i.opacity&&(i.opacity=.9)):s.depthFailMaterial=void 0;break;case"closure":!this.isEntity&&(s.loop=e);break;default:this._toOneCesiumVal_Poly(t,e,i,s)}}_toOneJson(t,e,i){if("loop"===t)i.closure=e;else this._toOneJson_Poly(t,e,i)}}const vn=Object.freeze(Object.defineProperty({__proto__:null,BaseMaterialConver:pn,BaseOptsConver:dn,BaseStyleConver:mn,ColorOptsConver:fn,ImageOptsConver:_n,LabelStyleConver:yn,PolylineStyleConver:gn},Symbol.toStringTag,{value:"Module"}));const Mn=Object.freeze(Object.defineProperty({__proto__:null,FlickerEntity:class{constructor(){n(this,"entitys"),n(this,"color"),n(this,"maxAlpha"),n(this,"time"),n(this,"onEnd"),n(this,"interval"),n(this,"timeEndVal"),this.color=u.Color.YELLOW.withAlpha(0)}_updateClr(){const t=this;this.entitys&&Xa(this.entitys,(e=>{e.point&&(e.point.color=t.color),e.billboard&&(e.billboard.color=t.color),e.model&&(e.model.color=t.color),e.label&&(e.label.fillColor=t.color)}))}_startTime(){const t=this.maxAlpha??.3,e=t/30;let i=0;this.interval=setInterval((()=>{var s;i+=e,i>t&&(i=0),this.color=null==(s=this.color)?void 0:s.withAlpha(i),this._updateClr()}),30),this.time&&(this.timeEndVal=setTimeout((()=>{this.stopFlicker()}),1e3*this.time))}_stopTime(){this.interval&&(clearInterval(this.interval),this.interval=void 0),this.timeEndVal&&(clearTimeout(this.timeEndVal),this.timeEndVal=void 0)}startFlicker(t,e={}){const i=this;return this.stopFlicker(),this.entitys=t,this.maxAlpha=u.defaultValue(e.maxAlpha,.3),this.time=e.time,this.color=Ca(e.color,u.Color.YELLOW),this.color=this.color.withAlpha(this.maxAlpha),this.onEnd=e.onEnd,this._startTime(),Xa(t,(t=>(t.polygon&&(t.polygon.material_bak=t.polygon.material,t.polygon.material=new u.ColorMaterialProperty(new u.CallbackProperty((t=>i.color),!1))),t.polyline&&(t.polyline.material_bak=t.polyline.material,t.polyline.material=new u.ColorMaterialProperty(new u.CallbackProperty((t=>i.color),!1))),t.ellipse&&(t.ellipse.material_bak=t.ellipse.material,t.ellipse.material=new u.ColorMaterialProperty(new u.CallbackProperty((t=>i.color),!1))),t.rectangle&&(t.rectangle.material_bak=t.rectangle.material,t.rectangle.material=new u.ColorMaterialProperty(new u.CallbackProperty((t=>i.color),!1))),t.wall&&(t.wall.material_bak=t.wall.material,t.wall.material=new u.ColorMaterialProperty(new u.CallbackProperty((t=>i.color),!1))),t.point&&(t.point.color_bak=t.point.color,t.point.color=i.color),t.billboard&&(t.billboard.color_bak=t.billboard.color,t.billboard.color=i.color),t.model&&(t.model.color_bak=t.model.color,t.model.color=i.color),t.label&&(t.label.fillColor_bak=t.label.fillColor,t.label.fillColor=i.color),t))),this}stopFlicker(){this._stopTime(),this.entitys&&(Xa(this.entitys,(t=>{t.polygon&&t.polygon.material_bak&&(t.polygon.material=t.polygon.material_bak),t.polyline&&t.polyline.material_bak&&(t.polyline.material=t.polyline.material_bak),t.ellipse&&t.ellipse.material_bak&&(t.ellipse.material=t.ellipse.material_bak),t.rectangle&&t.rectangle.material_bak&&(t.rectangle.material=t.rectangle.material_bak),t.wall&&t.wall.material_bak&&(t.wall.material=t.wall.material_bak),t.point&&t.point.color_bak&&(t.point.color=t.point.color_bak),t.billboard&&(t.billboard.color_bak?t.billboard.color=t.billboard.color_bak:t.billboard.color=void 0),t.model&&(t.model.color_bak?t.model.color=t.model.color_bak:t.model.color=void 0),t.label&&t.label.fillColor_bak&&(t.label.fillColor=t.label.fillColor_bak)})),this.onEnd&&this.onEnd(this.entitys),this.entitys=void 0)}},HighlightTileset:te},Symbol.toStringTag,{value:"Module"})),Cn=Object.freeze(Object.defineProperty({__proto__:null,BaseLayer:K,BaseTileLayer:Bt,GroupLayer:Ft,ImageLayer:Ut,TerrainLayer:qt,TilesetLayer:ee,WmsLayer:Zt,WmtsLayer:Jt,XyzLayer:Qt},Symbol.toStringTag,{value:"Module"}));$(se.Color,u.ColorMaterialProperty),$(se.Image,u.ImageMaterialProperty),$(se.PolylineArrow,u.PolylineArrowMaterialProperty),$(se.PolylineOutline,u.PolylineOutlineMaterialProperty),$(se.PolylineDash,u.PolylineDashMaterialProperty),$(se.PolylineGlow,u.PolylineGlowMaterialProperty),$(se.Grid,u.GridMaterialProperty),$(se.Checkerboard,u.CheckerboardMaterialProperty),$(se.Stripe,u.StripeMaterialProperty);u.Material.ColorPatternGradientType=se.ColorPatternGradient,u.Material._materialCache.addMaterial(u.Material.ColorPatternGradientType,{fabric:{type:u.Material.ColorPatternGradientType,uniforms:{u_image:u.Material.DefaultImageId,u_colorImage:u.Material.DefaultImageId,u_alpha:.8,u_minValue:0,u_maxValue:50,u_resultSize:new u.Cartesian2(2880,1440)},source:"uniform float u_minValue;\r\nuniform float u_maxValue;\r\nuniform vec2 u_resultSize;\r\nfloat val;\r\nfloat calcTexture(sampler2D tex, const vec2 uv) {\r\n    return texture(tex, uv).r;\r\n  }\n\n  float bilinear(sampler2D tex, const vec2 uv) {\r\n    vec2 px = 1.0 / u_resultSize;\r\n    vec2 vc = (floor(uv * u_resultSize)) * px;\r\n    vec2 f = fract(uv * u_resultSize);\r\n    float tl = calcTexture(tex, vc);\r\n    float tr = calcTexture(tex, vc + vec2(px.x, 0));\r\n    float bl = calcTexture(tex, vc + vec2(0, px.y));\r\n    float br = calcTexture(tex, vc + px);\r\n    return mix(mix(tl, tr, f.x), mix(bl, br, f.x), f.y);\r\n  }\n\n  float getValue(sampler2D tex, const vec2 uv) {\r\n    float r = bilinear(tex, uv);\r\n    return r * (u_maxValue - u_minValue) + u_minValue;\r\n  }\r\nczm_material czm_getMaterial(czm_materialInput materialInput) {\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st;\r\n  vec4 color1 = texture(u_image, st);\n\n  float value = getValue(u_image, materialInput.st);\r\n  val = value;\r\n  float value_t = (value - u_minValue) / (u_maxValue - u_minValue);\n\n  vec4 color = texture(u_colorImage, vec2(value_t, 0.5));\n\n  color = czm_gammaCorrect(color);\r\n  float mixVal = 0.0;\r\n  float maxVal = 255.0;\r\n  if(color1.r < (mixVal / 255.0)) {\r\n    color.a = 0.0;\r\n  }\r\n  if(color1.r > (maxVal / 255.0)) {\r\n    color.a = 0.0;\r\n  }\n\n  material.diffuse = color.rgb;\r\n  material.alpha = min(u_alpha, color.a);\r\n  return material;\r\n}"},translucent:!0});var xn="uniform vec4 color;\r\nuniform float repeat;\r\nuniform float offset;\r\nuniform float thickness;\r\nczm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n    czm_material material = czm_getDefaultMaterial(materialInput);\r\n    float sp = 1.0/repeat;\r\n    vec2 st = materialInput.st;\r\n    float dis = distance(st, vec2(0.5));\r\n    float m = mod(dis + offset, sp);\r\n    float a = step(sp*(1.0-thickness), m);\r\n    material.diffuse = color.rgb;\r\n    material.alpha = a * color.a;\r\n    return material;\r\n}";class bn extends u.Material{constructor(t={}){super(function(t={}){return{fabric:{uniforms:{color:Ca(t.color,new u.Color(2,1,0,.8)),repeat:u.defaultValue(t.repeat,30),thickness:u.defaultValue(t.thickness,.3),offset:0},source:xn},translucent:t=>t.uniforms.color.alpha<1}}(t)),n(this,"frameTime"),n(this,"animateFrame"),this.frameTime=1e3/(t.frameRate||60);const e=this;let i=Date.now();!function t(){e.animateFrame=window.requestAnimationFrame(t);const s=Date.now(),r=s-i;r>e.frameTime&&(i=s-r%e.frameTime,e._updateOffset())}()}_updateOffset(){let t=this.uniforms.offset;t-=.001,t>1&&(t=0),this.uniforms.offset=t}destroy(){u.defined(this.animateFrame)&&(window.cancelAnimationFrame(this.animateFrame),delete this.animateFrame),super.destroy()}}Y(se.CylinderWave,bn);var wn="uniform sampler2D image;\r\nuniform float opacity;\r\nuniform vec4 color;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st;\r\n  vec4 colorImage = texture2D(image,st);\r\n  if(colorImage.rgb == vec3(1.0)){\r\n    discard;\r\n  }\r\n  material.alpha = colorImage.a * opacity * color.a;\r\n  material.diffuse = colorImage.rgb * color.rgb;\r\n  return material;\r\n}";class Pn extends u.Material{constructor(t={}){super(function(t={}){const e=t.text;t.font_size=t.font_size||70;const i=yn.toCesiumVal(t,{fill:!0,fillColor:new u.Color(1,1,0,1),textBaseline:"middle",padding:10});let s;if(e){const t=Pa(e,i);t&&(s=t.toDataURL("image/png"))}return{fabric:{uniforms:{image:s,opacity:1,color:u.Color.WHITE},source:wn},translucent:!0}}(t))}}Y(se.Text,Pn);class Sn{constructor(t={}){n(this,"_definitionChanged"),n(this,"_color"),n(this,"_colorSubscription"),n(this,"_speed"),n(this,"_speedSubscription"),n(this,"options"),this.options=t,this._definitionChanged=new u.Event,this._color=void 0,this._colorSubscription=void 0,this._speed=void 0,this._speedSubscription=void 0}get isConstant(){return!0}get definitionChanged(){return this._definitionChanged}}class Tn extends Sn{constructor(t){super(t),n(this,"_image"),this._image=t.image,this._color=Ca(t.color,new u.Color(1,0,0,.5))}getType(t){return se.CircleScan}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.image=this._image,e}equals(t){return this==t||t instanceof Tn&&u.Property.equals(this._color,t._color)&&this._image==t._image}}$(se.CircleScan,Tn),u.Material.CircleScanType=se.CircleScan,u.Material._materialCache.addMaterial(u.Material.CircleScanType,{fabric:{type:u.Material.CircleScanType,uniforms:{color:new u.Color(1,0,0,1),image:u.Material.DefaultImageId},source:"czm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n    czm_material material = czm_getDefaultMaterial(materialInput);\r\n    vec2 st = materialInput.st;\r\n    vec4 imgC = texture2D(image,st);\r\n    if(imgC.a>.0){\r\n        material.diffuse = color.rgb;\r\n    }\r\n    material.alpha = imgC.a * color.a;\r\n    return material;\r\n}"},translucent:!0});class En extends Sn{constructor(t={}){super(t),n(this,"_count"),n(this,"_gradient"),this._color=Ca(t.color,u.Color.YELLOW),this._speed=u.defaultValue(t.speed,10),this._count=u.defaultValue(t.count,1),this._gradient=u.defaultValue(t.gradient,.1),this._count<=0&&(this._count=1),this._gradient<0&&(this._gradient=0),this._gradient>1&&(this._gradient=1)}getType(t){return se.CircleWave}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.speed=this._speed,e.count=this._count,e.gradient=this._gradient,e}equals(t){return this==t||t instanceof En&&u.Property.equals(this._color,t._color)&&this._count==t._count&&this._speed==t._speed&&this._gradient==t._gradient}}$(se.CircleWave,En),u.Material.CircleWaveType=se.CircleWave,u.Material._materialCache.addMaterial(u.Material.CircleWaveType,{fabric:{type:u.Material.CircleWaveType,uniforms:{color:new u.Color(1,1,0,1),speed:10,count:1,gradient:.1},source:"czm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n    czm_material material = czm_getDefaultMaterial(materialInput);\r\n    material.diffuse = 1.5 * color.rgb;\r\n    vec2 st = materialInput.st;\n\n    float dis = distance(st, vec2(0.5, 0.5));\r\n    float per = fract(speed*czm_frameNumber/1000.0);\r\n    if(count==1.0){\r\n        if(dis > per * 0.5){ \r\n            discard;\r\n        }else {\r\n            material.alpha = color.a  * dis / per / 2.0;\r\n        }\r\n    }\r\n    else{\r\n        vec3 str = materialInput.str;\r\n        if(abs(str.z)>0.001){\r\n            discard;\r\n        }\r\n        if(dis >0.5){\r\n            discard;\r\n        }\r\n        else {\r\n            float perDis = 0.5/count;\r\n            float disNum;\r\n            float bl = 0.0;\r\n            for(int i=0;i<=999;i++){\r\n                if(float(i)<=count){\r\n                    disNum = perDis*float(i) - dis + per/count;\r\n                    if(disNum>0.0){\r\n                        if(disNum<perDis){\r\n                            bl = 1.0-disNum/perDis;\r\n                        }\r\n                        else if(disNum-perDis<perDis){\r\n                            bl = 1.0 - abs(1.0-disNum/perDis);\r\n                        }\r\n                        material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    } \r\n    return material;\r\n}"},translucent:!0});class kn extends Sn{constructor(t={}){super(t),n(this,"_repeat"),n(this,"_thickness"),n(this,"_offset"),this._color=Ca(t.color,new u.Color(2,1,0,.8)),this._repeat=u.defaultValue(t.repeat,30),this._thickness=u.defaultValue(t.thickness,.3),this._offset=0}getType(t){return se.CylinderWave}getValue(t,e){return!u.defined(e)&&(e={}),this._offset-=.001,this._offset>1&&(this._offset=0),e.color=this._color,e.repeat=this._repeat,e.offset=this._offset,e.thickness=this._thickness,e}equals(t){return this==t||t instanceof kn&&u.Property.equals(this._color,t._color)&&this._repeat==t._repeat&&this._offset==t._offset&&this._thickness==t._thickness}}$(se.CylinderWave,kn),u.Material.CylinderWaveType=se.CylinderWave,u.Material._materialCache.addMaterial(u.Material.CylinderWaveType,{fabric:{type:u.Material.CylinderWave,uniforms:{color:new u.Color(2,1,0,.8),repeat:30,thickness:.3,offset:0},source:xn},translucent:!0});class In extends Sn{constructor(t={}){super(t),this._color=Ca(t.color,new u.Color(0,0,0,0)),this._speed=u.defaultValue(t.speed,5)}getType(t){return se.EllipsoidElectric}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.speed=this._speed,e}equals(t){return this==t||t instanceof In&&u.Property.equals(this._color,t._color)&&this._speed==t._speed}}$(se.EllipsoidElectric,In),u.Material.EllipsoidElectricType=se.EllipsoidElectric,u.Material._materialCache.addMaterial(u.Material.EllipsoidElectricType,{fabric:{type:u.Material.EllipsoidElectricType,uniforms:{color:new u.Color(0,1,1,.7),speed:5},source:"uniform vec4 color;\r\nuniform float speed;\n\n#define pi 3.1415926535\r\n#define PI2RAD 0.01745329252\r\n#define TWO_PI (2. * PI)\n\nfloat rands(float p){\r\n  return fract(sin(p) * 10000.0);\r\n}\n\nfloat noise(vec2 p){\r\n  float time = fract( czm_frameNumber * speed / 1000.0);\r\n  float t = time / 20000.0;\r\n  if(t > 1.0) t -= floor(t);\r\n  return rands(p.x * 14. + p.y * sin(t) * 0.5);\r\n}\n\nvec2 sw(vec2 p){\r\n  return vec2(floor(p.x), floor(p.y));\r\n}\n\nvec2 se(vec2 p){\r\n  return vec2(ceil(p.x), floor(p.y));\r\n}\n\nvec2 nw(vec2 p){\r\n  return vec2(floor(p.x), ceil(p.y));\r\n}\n\nvec2 ne(vec2 p){\r\n  return vec2(ceil(p.x), ceil(p.y));\r\n}\n\nfloat smoothNoise(vec2 p){\r\n  vec2 inter = smoothstep(0.0, 1.0, fract(p));\r\n  float s = mix(noise(sw(p)), noise(se(p)), inter.x);\r\n  float n = mix(noise(nw(p)), noise(ne(p)), inter.x);\r\n  return mix(s, n, inter.y);\r\n}\n\nfloat fbm(vec2 p){\r\n  float z = 2.0;\r\n  float rz = 0.0;\r\n  vec2 bp = p;\r\n  for(float i = 1.0; i < 6.0; i++){\r\n    rz += abs((smoothNoise(p) - 0.5)* 2.0) / z;\r\n    z *= 2.0;\r\n    p *= 2.0;\r\n  }\r\n  return rz;\r\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st;\r\n  vec2 st2 = materialInput.st;\r\n  float time = fract( czm_frameNumber * speed / 1000.0);\r\n  if (st.t < 0.5) {\r\n    discard;\r\n  }\r\n  st *= 4.;\r\n  float rz = fbm(st);\r\n  st /= exp(mod( time * 2.0, pi));\r\n  rz *= pow(15., 0.9);\r\n  vec4 temp = vec4(0);\r\n  temp = mix( color / rz, vec4(color.rgb, 0.1), 0.2);\r\n  if (st2.s < 0.05) {\r\n    temp = mix(vec4(color.rgb, 0.1), temp, st2.s / 0.05);\r\n  }\r\n  if (st2.s > 0.95){\r\n    temp = mix(temp, vec4(color.rgb, 0.1), (st2.s - 0.95) / 0.05);\r\n  }\r\n  material.diffuse = temp.rgb;\r\n  material.alpha = temp.a * 2.0;\r\n  return material;\r\n}"},translucent:!0});class Ln extends Sn{constructor(t={}){super(t),this._color=Ca(t.color,new u.Color(0,0,0,0)),this._speed=u.defaultValue(t.speed,5)}getType(t){return se.EllipsoidWave}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.speed=this._speed,e}equals(t){return this==t||t instanceof Ln&&u.Property.equals(this._color,t._color)&&this._speed==t._speed}}$(se.EllipsoidWave,Ln),u.Material.EllipsoidWaveType=se.EllipsoidWave,u.Material._materialCache.addMaterial(u.Material.EllipsoidWaveType,{fabric:{type:u.Material.EllipsoidWaveType,uniforms:{color:new u.Color(0,1,1,.7),speed:5},source:"uniform vec4 color;\r\nuniform float speed;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st;\r\n  float time = fract(czm_frameNumber * speed / 1000.0);\r\n  float alpha = abs(smoothstep(0.5,1.,fract( -st.t - time)));\r\n  alpha += .1;\r\n  material.alpha = alpha;\r\n  material.diffuse = color.rgb;\r\n  return material;\r\n}"},translucent:!0});class An extends Sn{constructor(t){super(t),n(this,"_image"),n(this,"_opacity"),this._image=t.image,this._opacity=u.defaultValue(t.opacity,1),this._color=u.defaultValue(t.color,u.Color.WHITE)}getType(t){return se.Image2}getValue(t,e){return!u.defined(e)&&(e={}),e.image=this._image,e.color=this._color,e.opacity=this._opacity,e}equals(t){return this==t||t instanceof An&&u.Property.equals(this._color,t._color)&&this._opacity==t._opacity&&this._image==t._image}}$(se.Image2,An),u.Material.Image2Type=se.Image2,u.Material._materialCache.addMaterial(u.Material.Image2Type,{fabric:{type:u.Material.Image2Type,uniforms:{image:u.Material.DefaultImageId,color:u.Color.WHITE,opacity:1},source:wn},translucent:!0});class On extends Sn{constructor(t={}){super(t),this._color=Ca(t.color,new u.Color(1,0,0,1)),this._speed=u.defaultValue(t.speed,2)}getType(t){return se.LineFlicker}getValue(t,e){return!u.defined(e)&&(e={}),e.color=Ca(this._color,new u.Color(1,0,0,1),t),e.speed=this._speed,e}equals(t){return this==t||t instanceof On&&u.Property.equals(this._color,t._color)&&this._speed==t._speed}}$(se.LineFlicker,On),u.Material.LineFlickerType=se.LineFlicker,u.Material._materialCache.addMaterial(u.Material.LineFlickerType,{fabric:{type:u.Material.LineFlickerType,uniforms:{color:new u.Color(1,0,0,.7),speed:10},source:"uniform vec4 color;\r\nuniform float speed;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  float time = fract( czm_frameNumber  *  speed / 1000.0);\r\n  vec2 st = materialInput.st;\r\n  float scalar = smoothstep(0.0,1.0,time);\r\n  material.diffuse = color.rgb * scalar;\r\n  material.alpha = color.a * scalar ;\r\n  return material;\r\n}"},translucent:!0});class zn extends Sn{constructor(t={}){super(t),n(this,"_percent"),n(this,"_alpha"),n(this,"_startTime"),this._color=Ca(t.color,new u.Color(0,0,0,0)),this._speed=u.defaultValue(t.speed,2),this._percent=u.defaultValue(t.percent,.04),this._alpha=u.defaultValue(t.alpha,.1),this._startTime=u.defaultValue(t.startTime,0)}getType(t){return se.LineFlowColor}getValue(t,e){return!u.defined(e)&&(e={}),e.color=xa(this._color,u.Color,t),e.speed=this._speed,e.percent=this._percent,e.alpha=this._alpha,e.startTime=this._startTime,e}equals(t){return this==t||t instanceof zn&&u.Property.equals(this._color,t._color)&&this._speed==t._speed&&this._percent==t._percent&&this._startTime==t._startTime&&this._alpha==t._alpha}}$(se.LineFlowColor,zn),u.Material.LineFlowColorType=se.LineFlowColor,u.Material._materialCache.addMaterial(u.Material.LineFlowColorType,{fabric:{type:u.Material.LineFlowColorType,uniforms:{color:new u.Color(1,0,0,.7),startTime:0,speed:2,percent:.04,alpha:.1},source:"uniform vec4 color;\r\nuniform float speed;\r\nuniform float startTime;\r\nuniform float percent;\r\nuniform float alpha;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st;\r\n  float t =fract(startTime +czm_frameNumber * speed / 1000.0);\r\n  t *= (1.0 + percent);\r\n  float alpha1 = smoothstep(t- percent, t, st.s) * step(-t, -st.s);\r\n  alpha1 += alpha;\r\n  material.diffuse = color.rgb;\r\n  material.alpha = alpha1;\r\n  return material;\r\n}"},translucent:!0});class Rn extends Sn{constructor(t){super(t),n(this,"_image"),n(this,"_axisY"),n(this,"_duration"),n(this,"_repeat"),n(this,"_image2"),n(this,"_color2"),n(this,"_hasImage2"),n(this,"_time"),this._image=t.image,this._color=Ca(t.color,new u.Color(0,0,0,0)),this._axisY=u.defaultValue(t.axisY,!1),this._speed=u.defaultValue(t.speed,10),this._duration=t.duration,this._repeat=u.defaultValue(t.repeat,new u.Cartesian2(1,1)),this._image2=t.image2,this._color2=Ca(t.color2,new u.Color(1,1,1)),this._hasImage2=u.defined(this._image2)}getType(t){return se.LineFlow}getValue(t,e){return!u.defined(e)&&(e={}),e.image=this._image,e.color=xa(this._color,u.Color,t),e.repeat=xa(this._repeat,u.Cartesian2,t),e.axisY=this._axisY,e.speed=xa(this._speed,Number,t),this._duration?(void 0===this._time&&(this._time=(new Date).getTime()),e.time=((new Date).getTime()-this._time)/(1e3*this._duration)):e.time=-1,e.hasImage2=this._hasImage2,e.image2=this._image2,e.color2=xa(this._color2,u.Color,t),e}equals(t){return this==t||t instanceof Rn&&u.Property.equals(this._color,t._color)&&u.Property.equals(this._repeat,t._repeat)&&this._image==t._image&&this._axisY==t._axisY&&this._speed==t._speed&&this._hasImage2==t._hasImage2&&this._image2==t._image2&&u.Property.equals(this._color2,t._color2)}}$(se.LineFlow,Rn),u.Material.LineFlowType=se.LineFlow,u.Material._materialCache.addMaterial(u.Material.LineFlowType,{fabric:{type:u.Material.LineFlowType,uniforms:{image:u.Material.DefaultImageId,color:new u.Color(1,0,0,1),repeat:new u.Cartesian2(1,1),axisY:!1,speed:10,time:-1,hasImage2:!1,image2:u.Material.DefaultImageId,color2:new u.Color(1,1,1)},source:"czm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n    czm_material material = czm_getDefaultMaterial(materialInput);\r\n    vec2 st = repeat * materialInput.st;\n\n    float currTime;\r\n    if(time < 0.0){\r\n     currTime = speed*czm_frameNumber/1000.0;\r\n    }\r\n    else{\r\n     currTime = time;\r\n    }\n\n    vec4 colorImage = texture2D(image, vec2(fract((axisY?st.t:st.s) - currTime), st.t));\r\n    if(color.a == 0.0) {\r\n       if(colorImage.rgb == vec3(1.0)){\r\n          discard;\r\n        }\r\n        material.alpha = colorImage.a;\r\n        material.diffuse = colorImage.rgb;\r\n    }\r\n    else {\r\n        material.alpha = colorImage.a * color.a;\r\n        material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\r\n    }\n\n    if(hasImage2)  {\r\n        vec4 colorBG = texture2D(image2,materialInput.st);\r\n        if(colorBG.a>0.5){\r\n            material.diffuse = color2.rgb;\r\n        }\r\n    }\r\n    return material;\r\n}"},translucent:!0});class Dn extends Sn{constructor(t={}){super(t),n(this,"_bgColor"),this._color=Ca(t.color,new u.Color(0,0,0,0)),this._bgColor=Ca(t.bgColor,this._color.withAlpha(.1)),this._speed=u.defaultValue(t.speed,2)}getType(t){return se.LineTrail}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.bgColor=this._bgColor,e.speed=this._speed,e}equals(t){return this==t||t instanceof Dn&&u.Property.equals(this._color,t._color)&&u.Property.equals(this._bgColor,t._bgColor)&&this._speed==t._speed}}$(se.LineTrail,Dn),u.Material.LineTrailType=se.LineTrail,u.Material._materialCache.addMaterial(u.Material.LineTrailType,{fabric:{type:u.Material.LineTrailType,uniforms:{color:new u.Color(1,0,0,.7),bgColor:new u.Color(0,0,0,0),speed:5},source:"uniform vec4 bgColor;\r\nuniform vec4 color;\r\nuniform float speed;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st;\r\n  float time = fract(czm_frameNumber * speed / 1000.0);\n\n  vec3 fragColor = color.rgb;\r\n  if(st.t > 0.45 && st.t < 0.55 ) {\r\n    fragColor = vec3(1.0);\r\n  }\r\n  material.alpha =  color.a * 1.5 * smoothstep(.0,1., fract(st.s - time));\r\n  material.diffuse = max(fragColor.rgb * material.alpha , fragColor.rgb);\n\n  if(material.alpha < bgColor.a){\r\n    material.alpha = bgColor.a;\r\n    material.diffuse = bgColor.rgb;\r\n  }\n\n  return material;\r\n}"},translucent:!0});class Nn extends Sn{constructor(t={}){super(t),n(this,"_bgColor"),n(this,"_startTime"),n(this,"_bidirectional"),this._color=Ca(t.color,new u.Color(.5*Math.random()+.5,.8*Math.random()+.2,0,1)),this._bgColor=Ca(t.bgColor,this._color.withAlpha(.1)),this._speed=u.defaultValue(t.speed,20+10*Math.random()),this._startTime=u.defaultValue(t.startTime,Math.random()),this._bidirectional=u.defaultValue(t.bidirectional,0)}getType(t){return se.ODLine}getValue(t,e){return!e&&(e={}),e.color=this._color,e.speed=this._speed,e.startTime=this._startTime,e.bgColor=this._bgColor,e.bidirectional=this._bidirectional,e}equals(t){return this==t||t instanceof Nn&&u.Property.equals(this._color,t._color)&&u.Property.equals(this._bgColor,t._bgColor)&&this._speed==t._speed&&this._startTime==t._startTime&&this._bidirectional==t._bidirectional}}$(se.ODLine,Nn),u.Material.ODLineType=se.ODLine,u.Material._materialCache.addMaterial(u.Material.ODLineType,{fabric:{type:u.Material.ODLineType,uniforms:{color:new u.Color(1,1,0,.7),startTime:0,speed:20,bgColor:new u.Color(1,1,0,.1),bidirectional:0},source:"uniform vec4 color;\r\nuniform vec4 bgColor;\r\nuniform float speed;\r\nuniform float startTime;\r\nuniform float bidirectional;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n    czm_material material = czm_getDefaultMaterial(materialInput);\r\n    vec2 st = materialInput.st;\r\n    float t = fract(startTime + czm_frameNumber * speed / 1000.0);\n\n    t *= 1.03;\r\n    float alpha0 = smoothstep(t - 0.03, t, st.s) * step(st.s, t);\r\n    float mt = 1. - t;\r\n    float alpha1 = smoothstep(mt + 0.03, mt, st.s) * step(mt, st.s);\n\n    float a0 = step(abs(bidirectional - 0.0) - 0.001, 0.);\r\n    float a1 = step(abs(bidirectional - 1.0) - 0.001, 0.);\r\n    float db = step(abs(bidirectional - 2.0) - 0.001, 0.);\r\n    float alpha = alpha0 * (a0 + db) + alpha1 * (a1 + db);\r\n    alpha = clamp(alpha, 0., 1.);\n\n    material.diffuse = color.rgb * alpha + bgColor.rgb * (1. - alpha);\r\n    material.alpha = color.a * alpha + bgColor.a * (1. - alpha);\n\n    \n    \n    \n    \n    \n    \n\n    return material;\r\n}"},translucent:!0});class Gn extends Sn{constructor(t={}){super(t),n(this,"_bumpSize"),n(this,"_roughness"),this._color=Ca(t.asphaltColor,u.Color.ORANGE),this._bumpSize=u.defaultValue(t.bumpSize,.02),this._roughness=u.defaultValue(t.roughness,.2)}getType(t){return se.PolyAsphalt}getValue(t,e){return!u.defined(e)&&(e={}),e.asphaltColor=this._color,e.bumpSize=this._bumpSize,e.roughness=this._roughness,e}equals(t){return this==t||t instanceof Gn&&u.Property.equals(this._color,t._color)&&this._bumpSize==t._bumpSize&&this._roughness==t._roughness}}$(se.PolyAsphalt,Gn),u.Material.PolyAsphaltType=se.PolyAsphalt,u.Material._materialCache.addMaterial(u.Material.PolyAsphaltType,{fabric:{type:u.Material.PolyAsphaltType,uniforms:{asphaltColor:u.Color.ORANGE,bumpSize:.02,roughness:.2},source:"uniform vec4 asphaltColor;\r\nuniform float bumpSize;\r\nuniform float roughness;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\n\n  \n  \n  vec4 color = asphaltColor;\r\n  vec2 st = materialInput.st;\r\n  vec2 F = czm_cellular(st / bumpSize);\r\n  color.rgb -= (F.x / F.y) * 0.1;\n\n  \n  float noise = czm_snoise(st / bumpSize);\r\n  noise = pow(noise, 5.0) * roughness;\r\n  color.rgb += noise;\n\n  material.diffuse = color.rgb;\r\n  material.alpha = color.a;\n\n  return material;\r\n}"},translucent:t=>t.uniforms.asphaltColor.alpha<1});class Vn extends Sn{constructor(t={}){super(t),n(this,"_lightColor"),n(this,"_darkColor"),n(this,"_frequency"),this._lightColor=Ca(t.lightColor,new u.Color(1,1,1,.5)),this._darkColor=Ca(t.darkColor,new u.Color(0,0,1,.5)),this._frequency=u.defaultValue(t.frequency,10)}getType(t){return se.PolyBlob}getValue(t,e){return!u.defined(e)&&(e={}),e.lightColor=this._lightColor,e.darkColor=this._darkColor,e.frequency=this._frequency,e}equals(t){return this==t||t instanceof Vn&&u.Property.equals(this._lightColor,t._lightColor)&&u.Property.equals(this._darkColor,t._darkColor)&&this._frequency==t._frequency}}$(se.PolyBlob,Vn),u.Material.PolyBlobType=se.PolyBlob,u.Material._materialCache.addMaterial(u.Material.PolyBlobType,{fabric:{type:u.Material.PolyBlobType,uniforms:{lightColor:new u.Color(1,1,1,.5),darkColor:new u.Color(0,0,1,.5),frequency:10},source:"uniform vec4 lightColor;\r\nuniform vec4 darkColor;\r\nuniform float frequency;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\n\n  \n  vec2 F = czm_cellular(materialInput.st * frequency);\r\n  float t = 1.0 - F.x * F.x;\n\n  vec4 color = mix(lightColor, darkColor, t);\r\n  material.diffuse = color.rgb;\r\n  material.alpha = color.a;\n\n  return material;\r\n}"},translucent(t){const e=t.uniforms;return e.lightColor.alpha<1||e.darkColor.alpha<0}});class jn extends Sn{constructor(t={}){super(t),n(this,"_lightColor"),n(this,"_darkColor"),n(this,"_frequency"),this._lightColor=Ca(t.lightColor,new u.Color(.25,.25,.25,.75)),this._darkColor=Ca(t.darkColor,new u.Color(.25,.25,.25,.75)),this._frequency=u.defaultValue(t.frequency,10)}getType(t){return se.PolyFacet}getValue(t,e){return!u.defined(e)&&(e={}),e.lightColor=this._lightColor,e.darkColor=this._darkColor,e.frequency=this._frequency,e}equals(t){return this==t||t instanceof jn&&u.Property.equals(this._lightColor,t._lightColor)&&u.Property.equals(this._darkColor,t._darkColor)&&this._frequency==t._frequency}}$(se.PolyFacet,jn),u.Material.PolyFacetType=se.PolyFacet,u.Material._materialCache.addMaterial(u.Material.PolyFacetType,{fabric:{type:u.Material.PolyFacetType,uniforms:{lightColor:new u.Color(.25,.25,.25,.75),darkColor:new u.Color(.75,.75,.75,.75),frequency:10},source:"uniform vec4 lightColor;\r\nuniform vec4 darkColor;\r\nuniform float frequency;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\n\n  \n  vec2 F = czm_cellular(materialInput.st * frequency);\r\n  float t = 0.1 + (F.y - F.x);\n\n  vec4 color = mix(lightColor, darkColor, t);\r\n  material.diffuse = color.rgb;\r\n  material.alpha = color.a;\n\n  return material;\r\n}"},translucent(t){const e=t.uniforms;return e.lightColor.alpha<1||e.darkColor.alpha<0}});class Fn extends Sn{constructor(t={}){super(t),n(this,"_diffusePower"),this._color=Ca(t.color,new u.Color(1,1,0,.5)),this._diffusePower=u.defaultValue(t.diffusePower,1.6)}getType(t){return se.PolyGradient}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.diffusePower=this._diffusePower,e}equals(t){return this==t||t instanceof Fn&&u.Property.equals(this._color,t._color)&&this._diffusePower==t._diffusePower}}$(se.PolyGradient,Fn),u.Material.PolyGradientType=se.PolyGradient,u.Material._materialCache.addMaterial(u.Material.PolyGradientType,{fabric:{type:u.Material.PolyGradientType,uniforms:{color:new u.Color(1,1,0,.5),diffusePower:1.6,alphaPower:1.5},source:"uniform vec4 color;\r\nuniform float diffusePower;\r\nuniform float alphaPower;\n\nczm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st;\r\n  float alpha = distance(st,vec2(0.5, 0.5));\r\n  material.alpha = color.a  * alpha  * alphaPower;\r\n  material.diffuse = color.rgb * diffusePower;\r\n  return material;\r\n}"},translucent:!0});class Wn extends Sn{constructor(t={}){super(t),n(this,"_grassColor"),n(this,"_dirtColor"),n(this,"_frequency"),this._grassColor=Ca(t.grassColor,new u.Color(.25,.4,.1,1)),this._dirtColor=Ca(t.dirtColor,new u.Color(.1,.1,.1,1)),this._frequency=u.defaultValue(t.frequency,10)}getType(t){return se.PolyGrass}getValue(t,e){return!u.defined(e)&&(e={}),e.grassColor=this._grassColor,e.dirtColor=this._dirtColor,e.frequency=this._frequency,e}equals(t){return this==t||t instanceof Wn&&u.Property.equals(this._grassColor,t._grassColor)&&u.Property.equals(this._dirtColor,t._dirtColor)&&this._frequency==t._frequency}}$(se.PolyGrass,Wn),u.Material.PolyGrassType=se.PolyGrass,u.Material._materialCache.addMaterial(u.Material.PolyGrassType,{fabric:{type:u.Material.PolyGrassType,uniforms:{grassColor:new u.Color(.25,.4,.1,1),dirtColor:new u.Color(.1,.1,.1,1),frequency:1.5},source:"uniform vec4 grassColor;\r\nuniform vec4 dirtColor;\r\nuniform float frequency;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\n\n  vec2 st = materialInput.st;\r\n  float noise1 = (czm_snoise(st * frequency * 1.0)) * 1.0;\r\n  float noise2 = (czm_snoise(st * frequency * 2.0)) * 0.5;\r\n  float noise3 = (czm_snoise(st * frequency * 4.0)) * 0.25;\r\n  float noise = sin(noise1 + noise2 + noise3) * 0.1;\n\n  vec4 color = mix(grassColor, dirtColor, noise);\n\n  \n  float verticalNoise = czm_snoise(vec2(st.x * 100.0, st.y * 20.0)) * 0.02;\r\n  float horizontalNoise = czm_snoise(vec2(st.x * 20.0, st.y * 100.0)) * 0.02;\r\n  float stripeNoise = min(verticalNoise, horizontalNoise);\n\n  color.rgb += stripeNoise;\n\n  material.diffuse = color.rgb;\r\n  material.alpha = color.a;\n\n  return material;\r\n}"},translucent(t){const e=t.uniforms;return e.grassColor.alpha<1||e.dirtColor.alpha<1}});class qn extends Sn{constructor(t={}){super(t),n(this,"_lightWoodColor"),n(this,"_darkWoodColor"),n(this,"_frequency"),n(this,"_noiseScale"),n(this,"_grainFrequency"),this._lightWoodColor=Ca(t.lightWoodColor,new u.Color(1,1,1,.5)),this._darkWoodColor=Ca(t.darkWoodColor,new u.Color(0,0,1,.5)),this._frequency=u.defaultValue(t.frequency,3),this._noiseScale=u.defaultValue(t.noiseScale,new u.Cartesian2(.7,.5)),this._grainFrequency=u.defaultValue(t.grainFrequency,27)}getType(t){return se.PolyWood}getValue(t,e){return!u.defined(e)&&(e={}),e.lightWoodColor=this._lightWoodColor,e.darkWoodColor=this._darkWoodColor,e.frequency=this._frequency,e.noiseScale=this._noiseScale,e.grainFrequency=this._grainFrequency,e}equals(t){return this==t||t instanceof qn&&u.Property.equals(this._lightWoodColor,t._lightWoodColor)&&u.Property.equals(this._darkWoodColor,t._darkWoodColor)&&u.Property.equals(this._noiseScale,t._noiseScale)&&this._frequency==t._frequency&&this._grainFrequency==t._grainFrequency}}$(se.PolyWood,qn),u.Material.PolyWoodType=se.PolyWood,u.Material._materialCache.addMaterial(u.Material.PolyWoodType,{fabric:{type:u.Material.PolyWoodType,uniforms:{lightWoodColor:new u.Color(.6,.3,.1,1),darkWoodColor:new u.Color(.4,.2,.07,1),frequency:3,noiseScale:new u.Cartesian2(.7,.5),grainFrequency:27},source:"uniform vec4 lightWoodColor;\r\nuniform vec4 darkWoodColor;\r\nuniform float frequency;\r\nuniform vec2 noiseScale;\r\nuniform float grainFrequency;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\n\n  \n  vec2 st = materialInput.st;\n\n  vec2 noisevec;\r\n  noisevec.x = czm_snoise(st * noiseScale.x);\r\n  noisevec.y = czm_snoise(st * noiseScale.y);\n\n  vec2 location = st + noisevec;\r\n  float dist = sqrt(location.x * location.x + location.y * location.y);\r\n  dist *= frequency;\n\n  float r = fract(dist + noisevec[0] + noisevec[1]) * 2.0;\r\n  if(r > 1.0)\r\n      r = 2.0 - r;\n\n  vec4 color = mix(lightWoodColor, darkWoodColor, r);\n\n  \n  r = abs(czm_snoise(vec2(st.x * grainFrequency, st.y * grainFrequency * 0.02))) * 0.2;\r\n  color.rgb += lightWoodColor.rgb * r;\n\n  material.diffuse = color.rgb;\r\n  material.alpha = color.a;\n\n  return material;\r\n}"},translucent(t){const e=t.uniforms;return e.lightWoodColor.alpha<1||e.darkWoodColor.alpha<1}});class Bn extends Sn{constructor(t={}){super(t),this._color=Ca(t.color,new u.Color(0,0,0,0)),this._speed=u.defaultValue(t.speed,5)}getType(t){return se.RadarLine}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.speed=this._speed,e}equals(t){return this==t||t instanceof Bn&&u.Property.equals(this._color,t._color)&&this._speed==t._speed}}$(se.RadarLine,Bn),u.Material.RadarLineType=se.RadarLine,u.Material._materialCache.addMaterial(u.Material.RadarLineType,{fabric:{type:u.Material.RadarLineType,uniforms:{color:new u.Color(0,1,1,.7),speed:5},source:"uniform vec4 color;\r\nuniform float speed;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st * 2.0 - 1.0;\r\n  float t = czm_frameNumber * speed / 1000.0 ;\r\n  vec3 col = vec3(0.0);\r\n  vec2 p = vec2(sin(t), cos(t));\r\n  float d = length(st - dot(p, st) * p);\r\n  if (dot(st, p) < 0.) {\r\n    d = length(st);\r\n  }\n\n  col = .006 / d * color.rgb;\n\n  if(distance(st,vec2(0)) >  0.99 ){\r\n    col =color.rgb;\r\n  }\n\n  material.alpha  = pow(length(col),2.0);\r\n  material.diffuse = col * 3.0 ;\r\n  return material;\r\n}"},translucent:!0});class Hn extends Sn{constructor(t={}){super(t),this._color=Ca(t.color,new u.Color(0,0,0,0)),this._speed=u.defaultValue(t.speed,5)}getType(t){return se.RadarWave}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.speed=this._speed,e}equals(t){return this==t||t instanceof Hn&&u.Property.equals(this._color,t._color)&&this._speed==t._speed}}$(se.RadarWave,Hn),u.Material.RadarWaveType=se.RadarWave,u.Material._materialCache.addMaterial(u.Material.RadarWaveType,{fabric:{type:u.Material.RadarWaveType,uniforms:{color:new u.Color(0,1,1,.7),speed:5},source:"uniform vec4 color;\r\nuniform float speed;\n\n#define PI 3.14159265359\n\nfloat rand(vec2 co){\r\n  return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);\r\n}\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  vec2 st = materialInput.st;\r\n  vec2 pos = st - vec2(0.5);\r\n  float time = czm_frameNumber * speed / 1000.0 ;\r\n  float r = length(pos);\r\n  float t = atan(pos.y, pos.x) - time * 2.5;\r\n  float a = (atan(sin(t), cos(t)) + PI)/(2.0*PI);\r\n  float ta = 0.5;\r\n  float v = smoothstep(ta-0.05,ta+0.05,a) * smoothstep(ta+0.05,ta-0.05,a);\r\n  vec3 flagColor = color.rgb * v;\r\n  float blink = pow(sin(time*1.5)*0.5+0.5, 0.8);\r\n  flagColor = color.rgb *  pow(a, 8.0*(.2+blink))*(sin(r*500.0)*.5+.5) ;\r\n  flagColor = flagColor * pow(r, 0.4);\r\n  material.alpha = length(flagColor) * 1.3;\r\n  material.diffuse = flagColor * 3.0;\r\n  return material;\r\n}"},translucent:!0});class Un extends Sn{constructor(t){super(t),n(this,"_image"),n(this,"_pure"),this._image=t.image,this._color=Ca(t.color,new u.Color(1,1,1,.9)),this._speed=u.defaultValue(t.speed,1),this._pure=!!t.pure}getType(t){return se.RectSlide}getValue(t,e){return!u.defined(e)&&(e={}),e.image=this._image,e.color=this._color,e.speed=this._speed,e.pure=this._pure,e}equals(t){return this==t||t instanceof Un&&u.Property.equals(this._color,t._color)&&this._image==t._image&&this._pure==t._pure&&this._speed==t._speed}}$(se.RectSlide,Un),u.Material.RectSlideType=se.RectSlide,u.Material._materialCache.addMaterial(u.Material.RectSlideType,{fabric:{type:u.Material.RectSlideType,uniforms:{image:u.Material.DefaultImageId,color:u.Color.WHITE,speed:10,pure:!1,diffusePower:1.3},source:"czm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n     czm_material material = czm_getDefaultMaterial(materialInput);\r\n     vec2 st = materialInput.st;\r\n     vec4 colorImage = texture2D(image, vec2(fract(st.s + czm_frameNumber * speed / 1000.0),fract(st.t)));\n\n    material.alpha = colorImage.a * color.a;\r\n    if(pure) {\r\n        material.diffuse = diffusePower * color.rgb;\r\n    }\r\n    else {\r\n        material.diffuse = colorImage.rgb;\r\n    }\r\n    return material;\r\n }"},translucent:!0});class Kn extends Sn{constructor(t={}){super(t),this._color=Ca(t.color,u.Color.YELLOW),this._speed=u.defaultValue(t.speed,10)}getType(t){return se.ScanLine}getValue(t,e){return!u.defined(e)&&(e={}),e.color=this._color,e.speed=this._speed,e}equals(t){return this==t||t instanceof Kn&&u.Property.equals(this._color,t._color)&&this._speed==t._speed}}$(se.ScanLine,Kn),u.Material.ScanLineType=se.ScanLine,u.Material._materialCache.addMaterial(u.Material.ScanLineType,{fabric:{type:u.Material.ScanLineType,uniforms:{color:new u.Color(1,1,0,1),speed:10},source:"float circle(vec2 uv, float r, float blur) {\r\n    float d = length(uv) * 2.0;\r\n    float c = smoothstep(r+blur, r, d);\r\n    return c;\r\n}\n\nuniform vec4 color;\r\nczm_material czm_getMaterial(czm_materialInput materialInput)\r\n{\r\n    czm_material material = czm_getDefaultMaterial(materialInput);\r\n    vec2 st = materialInput.st - .5;\r\n    material.diffuse = color.rgb;\r\n    material.emission = vec3(0);\n\n    float t =fract(czm_frameNumber * speed / 1000.0);\r\n    float s = 0.3;\r\n    float radius1 = smoothstep(.0, s, t) * 0.5;\r\n    float alpha1 = circle(st, radius1, 0.01) * circle(st, radius1, -0.01);\r\n    float alpha2 = circle(st, radius1, 0.01 - radius1) * circle(st, radius1, 0.01);\r\n    float radius2 = 0.5 + smoothstep(s, 1.0, t) * 0.5;\r\n    float alpha3 = circle(st, radius1, radius2 + 0.01 - radius1) * circle(st, radius1, -0.01);\n\n    material.alpha = smoothstep(1.0, s, t) * (alpha1 + alpha2*0.1 + alpha3*0.1);\r\n    material.alpha *= color.a;\n\n    return material;\r\n}"},translucent:!0});class Zn extends An{constructor(t){super({...t,image:""}),n(this,"transparent"),n(this,"_textStyles"),n(this,"_canvas"),this.transparent=!0,this.options.text=t.text,t.font_size=t.font_size||70,this._textStyles=yn.toCesiumVal(t,{fill:!0,fillColor:new u.Color(1,1,0,1),textBaseline:"middle",padding:10}),this._updateImage()}get text(){return this.options.text}set text(t){this.options.text=t,this._updateImage()}get textStyles(){return this._textStyles}set textStyles(t){this._textStyles=yn.toCesiumVal(t,this._textStyles),this._updateImage()}_updateImage(){var t;if(this._canvas=Pa(this.options.text,this._textStyles),this._canvas&&(this._image=this._canvas.toDataURL("image/png"),null==(t=this.options)?void 0:t.onCustomCanvas)){const t=this.options.onCustomCanvas(this._canvas,this);(null==t?void 0:t.then)&&t.then((t=>{this._image=t.toDataURL("image/png")}))}}}$(se.Text,Zn);class Xn extends Sn{constructor(t){super(t),n(this,"_image"),n(this,"_count"),this._image=t.image,this._color=Ca(t.color,u.Color.RED),this._speed=u.defaultValue(t.speed,10),this._count=u.defaultValue(t.count,1)}getType(t){return se.WallScroll}getValue(t,e){return!u.defined(e)&&(e={}),e.image=this._image,e.color=this._color,e.speed=this._speed,e.count=this._count,e}equals(t){return this==t||t instanceof Xn&&u.Property.equals(this._color,t._color)&&this._image==t._image&&this._count==t._count&&this._speed==t._speed}}$(se.WallScroll,Xn),u.Material.WallScrollType=se.WallScroll,u.Material._materialCache.addMaterial(u.Material.WallScrollType,{fabric:{type:u.Material.WallScrollType,uniforms:{color:new u.Color(1,0,0,.7),image:u.Material.DefaultImageId,count:1,speed:5},source:"uniform sampler2D image;\r\nuniform float speed;\r\nuniform vec4 color;\r\nuniform float count;\n\nczm_material czm_getMaterial(czm_materialInput materialInput){\r\n  czm_material material = czm_getDefaultMaterial(materialInput);\r\n  float perDis = 1.0 / count / 3.0  ;\r\n  vec2 st = materialInput.st * vec2(1.0,count);\r\n  float time = fract(czm_frameNumber * speed / 1000.0);\r\n  vec4 colorImage = texture2D(image, vec2(fract(st.t - time),st.t));\r\n  material.alpha =  colorImage.a * smoothstep(.2 ,1. ,distance(st.t * perDis ,1. + perDis ));\r\n  material.diffuse = max(color.rgb * material.alpha * 1.5, color.rgb);\r\n  material.emission = max(color.rgb * material.alpha * 1.5, color.rgb);\r\n  return material;\r\n}"},translucent:!0});class Jn extends Sn{constructor(t={}){super(t),n(this,"baseWaterColor"),n(this,"blendColor"),n(this,"specularMap"),n(this,"normalMap"),n(this,"frequency"),n(this,"animationSpeed"),n(this,"amplitude"),n(this,"specularIntensity"),n(this,"fadeFactor"),this.baseWaterColor=Ca(t.baseWaterColor,new u.Color(.2,.3,.6,1)),this.blendColor=Ca(t.blendColor,new u.Color(0,1,.699,1)),this.specularMap=t.specularMap||u.Material.DefaultImageId,this.normalMap=t.normalMap||u.Material.DefaultImageId,this.frequency=u.defaultValue(t.frequency,1e3),this.animationSpeed=u.defaultValue(t.animationSpeed,.01),this.amplitude=u.defaultValue(t.amplitude,10),this.specularIntensity=u.defaultValue(t.specularIntensity,.5),this.fadeFactor=u.defaultValue(t.fadeFactor,1)}getType(t){return se.Water}getValue(t,e){return!e&&(e={}),e.baseWaterColor=u.Property.getValueOrUndefined(this.baseWaterColor,t),e.blendColor=u.Property.getValueOrUndefined(this.blendColor,t),e.specularMap=u.Property.getValueOrUndefined(this.specularMap,t),e.normalMap=u.Property.getValueOrUndefined(this.normalMap,t),e.frequency=this.frequency,e.animationSpeed=this.animationSpeed,e.amplitude=this.amplitude,e.specularIntensity=this.specularIntensity,e.fadeFactor=this.fadeFactor,e}equals(t){return this==t||t instanceof Jn&&u.Property.equals(this.baseWaterColor,t.baseWaterColor)&&u.Property.equals(this.blendColor,t.blendColor)&&u.Property.equals(this.specularMap,t.specularMap)&&u.Property.equals(this.normalMap,t.normalMap)&&this.frequency==t.frequency&&this.animationSpeed==t.animationSpeed&&this.amplitude==t.amplitude&&this.specularIntensity==t.specularIntensity&&this.fadeFactor==t.fadeFactor}}Object.defineProperties(Jn.prototype,{baseWaterColor:u.createPropertyDescriptor("baseWaterColor"),blendColor:u.createPropertyDescriptor("blendColor"),specularMap:u.createPropertyDescriptor("specularMap"),normalMap:u.createPropertyDescriptor("normalMap")}),$(se.Water,Jn),u.ShaderSource._czmBuiltinsAndUniforms.czm_cellular="vec3 _czm_permute289(vec3 x)\r\n{\r\n    return mod((34.0 * x + 1.0) * x, 289.0);\r\n}\n\n/**\r\n * DOC_TBA\r\n *\r\n * Implemented by Stefan Gustavson, and distributed under the MIT License.  {@link http:\n *\r\n * @name czm_cellular\r\n * @glslFunction\r\n *\r\n * @see Stefan Gustavson's chapter, <i>Procedural Textures in GLSL</i>, in <a href=\"http:\n */\r\nvec2 czm_cellular(vec2 P)\n\n{\r\n#define K 0.142857142857 \n#define Ko 0.428571428571 \n#define jitter 1.0 \n    vec2 Pi = mod(floor(P), 289.0);\r\n    vec2 Pf = fract(P);\r\n    vec3 oi = vec3(-1.0, 0.0, 1.0);\r\n    vec3 of = vec3(-0.5, 0.5, 1.5);\r\n    vec3 px = _czm_permute289(Pi.x + oi);\r\n    vec3 p = _czm_permute289(px.x + Pi.y + oi); \n    vec3 ox = fract(p*K) - Ko;\r\n    vec3 oy = mod(floor(p*K),7.0)*K - Ko;\r\n    vec3 dx = Pf.x + 0.5 + jitter*ox;\r\n    vec3 dy = Pf.y - of + jitter*oy;\r\n    vec3 d1 = dx * dx + dy * dy; \n    p = _czm_permute289(px.y + Pi.y + oi); \n    ox = fract(p*K) - Ko;\r\n    oy = mod(floor(p*K),7.0)*K - Ko;\r\n    dx = Pf.x - 0.5 + jitter*ox;\r\n    dy = Pf.y - of + jitter*oy;\r\n    vec3 d2 = dx * dx + dy * dy; \n    p = _czm_permute289(px.z + Pi.y + oi); \n    ox = fract(p*K) - Ko;\r\n    oy = mod(floor(p*K),7.0)*K - Ko;\r\n    dx = Pf.x - 1.5 + jitter*ox;\r\n    dy = Pf.y - of + jitter*oy;\r\n    vec3 d3 = dx * dx + dy * dy; \n    \n    vec3 d1a = min(d1, d2);\r\n    d2 = max(d1, d2); \n    d2 = min(d2, d3); \n    d1 = min(d1a, d2); \n    d2 = max(d1a, d2); \n    d1.xy = (d1.x < d1.y) ? d1.xy : d1.yx; \n    d1.xz = (d1.x < d1.z) ? d1.xz : d1.zx; \n    d1.yz = min(d1.yz, d2.yz); \n    d1.y = min(d1.y, d1.z); \n    d1.y = min(d1.y, d2.x); \n    return sqrt(d1.xy);\r\n}",u.ShaderSource._czmBuiltinsAndUniforms.czm_snoise='vec4 _czm_mod289(vec4 x)\r\n{\r\n  return x - floor(x * (1.0 / 289.0)) * 289.0;\r\n}\n\nvec3 _czm_mod289(vec3 x)\r\n{\r\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\r\n}\n\nvec2 _czm_mod289(vec2 x)\r\n{\r\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\r\n}\n\nfloat _czm_mod289(float x)\r\n{\r\n    return x - floor(x * (1.0 / 289.0)) * 289.0;\r\n}\n\nvec4 _czm_permute(vec4 x)\r\n{\r\n    return _czm_mod289(((x*34.0)+1.0)*x);\r\n}\n\nvec3 _czm_permute(vec3 x)\r\n{\r\n    return _czm_mod289(((x*34.0)+1.0)*x);\r\n}\n\nfloat _czm_permute(float x)\r\n{\r\n    return _czm_mod289(((x*34.0)+1.0)*x);\r\n}\n\nvec4 _czm_taylorInvSqrt(vec4 r)\r\n{\r\n    return 1.79284291400159 - 0.85373472095314 * r;\r\n}\n\nfloat _czm_taylorInvSqrt(float r)\r\n{\r\n    return 1.79284291400159 - 0.85373472095314 * r;\r\n}\n\nvec4 _czm_grad4(float j, vec4 ip)\r\n{\r\n    const vec4 ones = vec4(1.0, 1.0, 1.0, -1.0);\r\n    vec4 p,s;\n\n    p.xyz = floor( fract (vec3(j) * ip.xyz) * 7.0) * ip.z - 1.0;\r\n    p.w = 1.5 - dot(abs(p.xyz), ones.xyz);\r\n    s = vec4(lessThan(p, vec4(0.0)));\r\n    p.xyz = p.xyz + (s.xyz*2.0 - 1.0) * s.www;\n\n    return p;\r\n}\n\n/**\r\n * DOC_TBA\r\n *\r\n * Implemented by Ian McEwan, Ashima Arts, and distributed under the MIT License.  {@link https:\n *\r\n * @name czm_snoise\r\n * @glslFunction\r\n *\r\n * @see <a href="https:\n * @see Stefan Gustavson\'s paper <a href="http:\n */\r\nfloat czm_snoise(vec2 v)\r\n{\r\n    const vec4 C = vec4(0.211324865405187,  \n                        0.366025403784439,  \n                       -0.577350269189626,  \n                        0.024390243902439); \n    \n    vec2 i  = floor(v + dot(v, C.yy) );\r\n    vec2 x0 = v -   i + dot(i, C.xx);\n\n    \n    vec2 i1;\r\n    \n    \n    i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);\r\n    \n    \n    \n    vec4 x12 = x0.xyxy + C.xxzz;\r\n    x12.xy -= i1;\n\n    \n    i = _czm_mod289(i); \n    vec3 p = _czm_permute( _czm_permute( i.y + vec3(0.0, i1.y, 1.0 )) + i.x + vec3(0.0, i1.x, 1.0 ));\n\n    vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);\r\n    m = m*m ;\r\n    m = m*m ;\n\n    \n    \n    vec3 x = 2.0 * fract(p * C.www) - 1.0;\r\n    vec3 h = abs(x) - 0.5;\r\n    vec3 ox = floor(x + 0.5);\r\n    vec3 a0 = x - ox;\n\n    \n    \n    m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );\n\n    \n    vec3 g;\r\n    g.x  = a0.x  * x0.x  + h.x  * x0.y;\r\n    g.yz = a0.yz * x12.xz + h.yz * x12.yw;\r\n    return 130.0 * dot(m, g);\r\n}\n\nfloat czm_snoise(vec3 v)\r\n{\r\n    const vec2  C = vec2(1.0/6.0, 1.0/3.0) ;\r\n    const vec4  D = vec4(0.0, 0.5, 1.0, 2.0);\n\n    \n    vec3 i  = floor(v + dot(v, C.yyy) );\r\n    vec3 x0 =   v - i + dot(i, C.xxx) ;\n\n    \n    vec3 g = step(x0.yzx, x0.xyz);\r\n    vec3 l = 1.0 - g;\r\n    vec3 i1 = min( g.xyz, l.zxy );\r\n    vec3 i2 = max( g.xyz, l.zxy );\n\n    \n    \n    \n    \n    vec3 x1 = x0 - i1 + C.xxx;\r\n    vec3 x2 = x0 - i2 + C.yyy; \n    vec3 x3 = x0 - D.yyy;      \n\n    \n    i = _czm_mod289(i);\r\n    vec4 p = _czm_permute( _czm_permute( _czm_permute(\r\n                i.z + vec4(0.0, i1.z, i2.z, 1.0 ))\r\n              + i.y + vec4(0.0, i1.y, i2.y, 1.0 ))\r\n              + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));\n\n    \n    \n    float n_ = 0.142857142857; \n    vec3  ns = n_ * D.wyz - D.xzx;\n\n    vec4 j = p - 49.0 * floor(p * ns.z * ns.z);  \n\n    vec4 x_ = floor(j * ns.z);\r\n    vec4 y_ = floor(j - 7.0 * x_ );    \n\n    vec4 x = x_ *ns.x + ns.yyyy;\r\n    vec4 y = y_ *ns.x + ns.yyyy;\r\n    vec4 h = 1.0 - abs(x) - abs(y);\n\n    vec4 b0 = vec4( x.xy, y.xy );\r\n    vec4 b1 = vec4( x.zw, y.zw );\n\n    \n    \n    vec4 s0 = floor(b0)*2.0 + 1.0;\r\n    vec4 s1 = floor(b1)*2.0 + 1.0;\r\n    vec4 sh = -step(h, vec4(0.0));\n\n    vec4 a0 = b0.xzyw + s0.xzyw*sh.xxyy ;\r\n    vec4 a1 = b1.xzyw + s1.xzyw*sh.zzww ;\n\n    vec3 p0 = vec3(a0.xy,h.x);\r\n    vec3 p1 = vec3(a0.zw,h.y);\r\n    vec3 p2 = vec3(a1.xy,h.z);\r\n    vec3 p3 = vec3(a1.zw,h.w);\n\n    \n    vec4 norm = _czm_taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\r\n    p0 *= norm.x;\r\n    p1 *= norm.y;\r\n    p2 *= norm.z;\r\n    p3 *= norm.w;\n\n    \n    vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);\r\n    m = m * m;\r\n    return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1),\r\n                                dot(p2,x2), dot(p3,x3) ) );\r\n}\n\nfloat czm_snoise(vec4 v)\r\n{\r\n    const vec4  C = vec4( 0.138196601125011,  \n                          0.276393202250021,  \n                          0.414589803375032,  \n                         -0.447213595499958); \n\n    \n    #define F4 0.309016994374947451\n\n    \n    vec4 i  = floor(v + dot(v, vec4(F4)) );\r\n    vec4 x0 = v -   i + dot(i, C.xxxx);\n\n    \n\n    \n    vec4 i0;\r\n    vec3 isX = step( x0.yzw, x0.xxx );\r\n    vec3 isYZ = step( x0.zww, x0.yyz );\r\n    \n    i0.x = isX.x + isX.y + isX.z;\r\n    i0.yzw = 1.0 - isX;\r\n    \n    i0.y += isYZ.x + isYZ.y;\r\n    i0.zw += 1.0 - isYZ.xy;\r\n    i0.z += isYZ.z;\r\n    i0.w += 1.0 - isYZ.z;\n\n    \n    vec4 i3 = clamp( i0, 0.0, 1.0 );\r\n    vec4 i2 = clamp( i0-1.0, 0.0, 1.0 );\r\n    vec4 i1 = clamp( i0-2.0, 0.0, 1.0 );\n\n    \n    \n    \n    \n    \n    vec4 x1 = x0 - i1 + C.xxxx;\r\n    vec4 x2 = x0 - i2 + C.yyyy;\r\n    vec4 x3 = x0 - i3 + C.zzzz;\r\n    vec4 x4 = x0 + C.wwww;\n\n    \n    i = _czm_mod289(i);\r\n    float j0 = _czm_permute( _czm_permute( _czm_permute( _czm_permute(i.w) + i.z) + i.y) + i.x);\r\n    vec4 j1 = _czm_permute( _czm_permute( _czm_permute( _czm_permute (\r\n               i.w + vec4(i1.w, i2.w, i3.w, 1.0 ))\r\n             + i.z + vec4(i1.z, i2.z, i3.z, 1.0 ))\r\n             + i.y + vec4(i1.y, i2.y, i3.y, 1.0 ))\r\n             + i.x + vec4(i1.x, i2.x, i3.x, 1.0 ));\n\n    \n    \n    vec4 ip = vec4(1.0/294.0, 1.0/49.0, 1.0/7.0, 0.0) ;\n\n    vec4 p0 = _czm_grad4(j0,   ip);\r\n    vec4 p1 = _czm_grad4(j1.x, ip);\r\n    vec4 p2 = _czm_grad4(j1.y, ip);\r\n    vec4 p3 = _czm_grad4(j1.z, ip);\r\n    vec4 p4 = _czm_grad4(j1.w, ip);\n\n    \n    vec4 norm = _czm_taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));\r\n    p0 *= norm.x;\r\n    p1 *= norm.y;\r\n    p2 *= norm.z;\r\n    p3 *= norm.w;\r\n    p4 *= _czm_taylorInvSqrt(dot(p4,p4));\n\n    \n    vec3 m0 = max(0.6 - vec3(dot(x0,x0), dot(x1,x1), dot(x2,x2)), 0.0);\r\n    vec2 m1 = max(0.6 - vec2(dot(x3,x3), dot(x4,x4)            ), 0.0);\r\n    m0 = m0 * m0;\r\n    m1 = m1 * m1;\r\n    return 49.0 * ( dot(m0*m0, vec3( dot( p0, x0 ), dot( p1, x1 ), dot( p2, x2 )))\r\n                  + dot(m1*m1, vec2( dot( p3, x3 ), dot( p4, x4 ) ) ) ) ;\r\n}';const Yn=Object.freeze(Object.defineProperty({__proto__:null,BaseMaterialProperty:Sn,CircleScanMaterialProperty:Tn,CircleWaveMaterialProperty:En,CylinderWaveMaterial:bn,CylinderWaveMaterialProperty:kn,EllipsoidElectricMaterialProperty:In,EllipsoidWaveMaterialProperty:Ln,Image2MaterialProperty:An,LineFlickerMaterialProperty:On,LineFlowColorMaterialProperty:zn,LineFlowMaterialProperty:Rn,LineTrailMaterialProperty:Dn,ODLineMaterialProperty:Nn,PolyAsphaltMaterialProperty:Gn,PolyBlobMaterialProperty:Vn,PolyFacetMaterialProperty:jn,PolyGradientMaterialProperty:Fn,PolyGrassMaterialProperty:Wn,PolyWoodMaterialProperty:qn,RadarLineMaterialProperty:Bn,RadarWaveMaterialProperty:Hn,RectSlideMaterialProperty:Un,ScanLineMaterialProperty:Kn,TextMaterial:Pn,TextMaterialProperty:Zn,WallScrollMaterialProperty:Xn,WaterMaterialProperty:Jn},Symbol.toStringTag,{value:"Module"}));Mi.defs("EPSG:4490","+proj=longlat +ellps=GRS80 +no_defs"),Mi.defs("EPSG:4491","+proj=tmerc +lat_0=0 +lon_0=75 +k=1 +x_0=13500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4492","+proj=tmerc +lat_0=0 +lon_0=81 +k=1 +x_0=14500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4493","+proj=tmerc +lat_0=0 +lon_0=87 +k=1 +x_0=15500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4494","+proj=tmerc +lat_0=0 +lon_0=93 +k=1 +x_0=16500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4495","+proj=tmerc +lat_0=0 +lon_0=99 +k=1 +x_0=17500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4496","+proj=tmerc +lat_0=0 +lon_0=105 +k=1 +x_0=18500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4497","+proj=tmerc +lat_0=0 +lon_0=111 +k=1 +x_0=19500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4498","+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=20500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4499","+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=21500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4500","+proj=tmerc +lat_0=0 +lon_0=129 +k=1 +x_0=22500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4501","+proj=tmerc +lat_0=0 +lon_0=135 +k=1 +x_0=23500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4513","+proj=tmerc +lat_0=0 +lon_0=75 +k=1 +x_0=25500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4514","+proj=tmerc +lat_0=0 +lon_0=78 +k=1 +x_0=26500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4515","+proj=tmerc +lat_0=0 +lon_0=81 +k=1 +x_0=27500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4516","+proj=tmerc +lat_0=0 +lon_0=84 +k=1 +x_0=28500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4517","+proj=tmerc +lat_0=0 +lon_0=87 +k=1 +x_0=29500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4518","+proj=tmerc +lat_0=0 +lon_0=90 +k=1 +x_0=30500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4519","+proj=tmerc +lat_0=0 +lon_0=93 +k=1 +x_0=31500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4520","+proj=tmerc +lat_0=0 +lon_0=96 +k=1 +x_0=32500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4521","+proj=tmerc +lat_0=0 +lon_0=99 +k=1 +x_0=33500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4522","+proj=tmerc +lat_0=0 +lon_0=102 +k=1 +x_0=34500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4523","+proj=tmerc +lat_0=0 +lon_0=105 +k=1 +x_0=35500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4524","+proj=tmerc +lat_0=0 +lon_0=108 +k=1 +x_0=36500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4525","+proj=tmerc +lat_0=0 +lon_0=111 +k=1 +x_0=37500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4526","+proj=tmerc +lat_0=0 +lon_0=114 +k=1 +x_0=38500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4527","+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=39500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4528","+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=40500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4529","+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=41500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4530","+proj=tmerc +lat_0=0 +lon_0=126 +k=1 +x_0=42500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4531","+proj=tmerc +lat_0=0 +lon_0=129 +k=1 +x_0=43500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4532","+proj=tmerc +lat_0=0 +lon_0=132 +k=1 +x_0=44500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4533","+proj=tmerc +lat_0=0 +lon_0=135 +k=1 +x_0=45500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4502","+proj=tmerc +lat_0=0 +lon_0=75 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4503","+proj=tmerc +lat_0=0 +lon_0=81 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4504","+proj=tmerc +lat_0=0 +lon_0=87 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4505","+proj=tmerc +lat_0=0 +lon_0=93 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4506","+proj=tmerc +lat_0=0 +lon_0=99 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4507","+proj=tmerc +lat_0=0 +lon_0=105 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4508","+proj=tmerc +lat_0=0 +lon_0=111 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4509","+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4510","+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4511","+proj=tmerc +lat_0=0 +lon_0=129 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4512","+proj=tmerc +lat_0=0 +lon_0=135 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4534","+proj=tmerc +lat_0=0 +lon_0=75 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4535","+proj=tmerc +lat_0=0 +lon_0=78 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4536","+proj=tmerc +lat_0=0 +lon_0=81 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4537","+proj=tmerc +lat_0=0 +lon_0=84 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4538","+proj=tmerc +lat_0=0 +lon_0=87 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4539","+proj=tmerc +lat_0=0 +lon_0=90 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4540","+proj=tmerc +lat_0=0 +lon_0=93 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4541","+proj=tmerc +lat_0=0 +lon_0=96 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4542","+proj=tmerc +lat_0=0 +lon_0=99 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4543","+proj=tmerc +lat_0=0 +lon_0=102 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4544","+proj=tmerc +lat_0=0 +lon_0=105 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4545","+proj=tmerc +lat_0=0 +lon_0=108 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4546","+proj=tmerc +lat_0=0 +lon_0=111 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4547","+proj=tmerc +lat_0=0 +lon_0=114 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4548","+proj=tmerc +lat_0=0 +lon_0=117 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4549","+proj=tmerc +lat_0=0 +lon_0=120 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4550","+proj=tmerc +lat_0=0 +lon_0=123 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4551","+proj=tmerc +lat_0=0 +lon_0=126 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4552","+proj=tmerc +lat_0=0 +lon_0=129 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4553","+proj=tmerc +lat_0=0 +lon_0=132 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),Mi.defs("EPSG:4554","+proj=tmerc +lat_0=0 +lon_0=135 +k=1 +x_0=500000 +y_0=0 +ellps=GRS80 +units=m +no_defs"),X("default",pn),X(se.Color,fn),X(se.PolylineArrow,fn),X(se.Image,_n),t.Cesium=u,t.turf=d,t.ColorPatternGradientLayer=rt,t.ColorPatternGridLayer=Dt,t.Earth=un,t.convers=vn,t.effects=Mn,t.enums=ae,t.layers=Cn,t.materials=Yn,t.utils=sn,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
